Dietary intake, Nutritional status, and Health outcomes among Vegan, Vegetarian and Omnivore families: results from the observational study

Statistical report - mixed-effects models in adults

Authors and affiliations

Marina Heniková1,2, Anna Ouřadová1, Eliška Selinger1,3, Filip Tichanek4, Petra Polakovičová4, Dana Hrnčířová2, Pavel Dlouhý2, Martin Světnička5, Eva El-Lababidi5, Jana Potočková1, Tilman Kühn6, Monika Cahová4, Jan Gojda1


1 Department of Internal Medicine, Kralovske Vinohrady University Hospital and Third Faculty of Medicine, Charles University, Prague, Czech Republic.
2 Department of Hygiene, Third Faculty of Medicine, Charles University, Prague, Czech Republic.
3 National Health Institute, Prague, Czech Republic.
4 Institute for Clinical and Experimental Medicine, Prague, Czech Republic.
5 Department of Pediatrics, Kralovske Vinohrady University Hospital and Third Faculty of Medicine, Charles University, Prague, Czech Republic.
6 Department of Epidemiology, MedUni, Vienna, Austria.


This is a statistical report of the study currenlty under review in the Communications Medicine journal.

When using this code or data, cite the original publication:

TO BE ADDED

BibTex citation for the original publication:

TO BE ADDED


Original GitHub repository: https://github.com/filip-tichanek/kompas_clinical

Statistical reports can be found on the reports hub.

Data analysis is described in detail in the statistical methods report.


1 Introduction

This project is designed to evaluate and compare clinical outcomes across three distinct dietary strategy groups:

  • Vegans
  • Vegetarians
  • Omnivores

The dataset includes both adults and children, with data clustered within families.

1.1 Main Questions

The study addresses the following key questions:

Q1. Do clinical outcomes vary significantly across different diet strategies?

Q2. Beyond diet group, which factors (e.g., sex, age, breastfeeding status for children, or supplementation when applicable) most strongly influence clinical outcomes? How correlated (“clustered”) are these characteristics within the same family?

Q3. Could the clinical characteristics effectively discriminate between different diet groups?

1.2 Statistical Methods

For full methodological details, see this report. In brief:

  • Robust linear mixed-effects models (rLME) were used to estimate adjusted differences between diet groups (Q1) and assess the importance of other variables (Q2), including how much clinical characteristics tend to cluster within families. Covariates included age, sex, breastfeeding status for children, and relevant supplementation factors where applicable.

  • Elastic net logistic regression was employed to answer Q3, evaluating whether clinical characteristics provide a strong overall signal distinguishing between diet groups, incorporating a predictive perspective.

All analyses were conducted separately for adults and children.

2 Analysis

2.1 Import initiation file

Open code
getwd()
## [1] "/home/ticf/GitRepo/ticf/368_MOCA_kompas_clinical"
setwd('/home/ticf/GitRepo/ticf/368_MOCA_kompas_clinical/')
source('r/368_initiation.R')

2.2 Mixed models

Adults models will be adjusted for the effect of aAGE, SEX. Relevant supplementation for vitamins and biogenic elements will be added as covariates.

Open code
AIC_adult <- data.frame(outcome = NA,
                            estimand = NA,
                            aAGE = NA,
                            aSEX = NA,
                            other_cov = NA,
                            diet = NA,
                            family = NA)

diet_adult <- data.frame(outcome = NA,
                         estimand = NA,
                         VN_OM_diff = NA, 
                         VN_OM_P = NA,
                         VG_OM_diff = NA, 
                         VG_OM_P = NA,
                         VN_VG_diff = NA, 
                         VN_VG_P = NA)


diet_adult_non_robust <- data.frame(outcome = NA,
                         estimand = NA,
                         VN_OM_diff = NA, 
                         VN_OM_P = NA,
                         VG_OM_diff = NA, 
                         VG_OM_P = NA,
                         VN_VG_diff = NA, 
                         VN_VG_P = NA)
i = 1
j = 1
ni= 5

2.2.1 aBMI

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aBMI"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  23.6583     0.5744  41.186  < 2e-16 ***
## SEXM          1.8660     0.4802   3.886  0.00015 ***
## GRPVG        -0.3709     0.7635  -0.486  0.62784    
## GRPVN        -1.2684     0.6610  -1.919  0.05682 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 0.518  0.4727  
## s(FAM)  25.56     92 0.381  0.0421 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.231   Deviance explained = 35.3%
## GCV = 11.843  Scale est. = 9.9077    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F p-value
## SEX  1 15.100 0.00015
## GRP  2  2.073 0.12931
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.518  0.4727
## s(FAM)  25.56  92.00 0.381  0.0421

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformed outcome

Open code
gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.54884    0.03350 135.802  < 2e-16 ***
## SEXM         0.11627    0.02841   4.092 6.77e-05 ***
## GRPVG       -0.02827    0.04439  -0.637   0.5252    
## GRPVN       -0.07795    0.03844  -2.028   0.0443 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 0.687  0.4086  
## s(FAM)  23.09     92 0.333  0.0605 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.226   Deviance explained = 33.8%
## GCV = 0.04091  Scale est. = 0.034766  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 16.748 6.77e-05
## GRP  2  2.219    0.112
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.687  0.4086
## s(FAM)  23.09  92.00 0.333  0.0605

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept) 22.24062674 1.73837238 12.7939370
## GRPVG       -0.88003943 0.67090599 -1.3117180
## GRPVN       -1.31850756 0.58158915 -2.2670773
## SEXM         2.00007815 0.49297263  4.0571789
## aAGE         0.03294712 0.04700117  0.7009852


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on body mass index, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on body mass index, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -1.3185076 -2.458401 -0.1786138 0.0233855
VG vs OM -0.8800394 -2.194991 0.4349121 0.1896153
VN vs VG -0.4384681 -1.615560 0.7386238 0.4653359

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.145
##   Unadjusted ICC: 0.129

i = i+1

2.2.2 aWHR

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aWHR"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.7556953  0.0087453  86.411   <2e-16 ***
## SEXM         0.0806633  0.0078054  10.334   <2e-16 ***
## GRPVG        0.0007818  0.0114524   0.068    0.946    
## GRPVN       -0.0153586  0.0099812  -1.539    0.126    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 4.795   0.030 *
## s(FAM)  14.55     92 0.190   0.158  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.455   Deviance explained =   51%
## GCV = 0.0029065  Scale est. = 0.0025959  n = 183
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F p-value
## SEX  1 106.80  <2e-16
## GRP  2   1.77   0.174
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 4.795   0.030
## s(FAM)  14.55  92.00 0.190   0.158

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                  Estimate   Std. Error     t value
## (Intercept)  0.6927888286 0.0290469719 23.85063854
## GRPVG        0.0002553297 0.0111566478  0.02288588
## GRPVN       -0.0141290444 0.0097355910 -1.45127752
## SEXM         0.0784653996 0.0082660173  9.49252783
## aAGE         0.0017007427 0.0007845351  2.16783504

res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on waist-to-hip ratio, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on waist-to-hip ratio, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0141290 -0.0332105 0.0049524 0.1467026
VG vs OM 0.0002553 -0.0216113 0.0221220 0.9817413
VN vs VG -0.0143844 -0.0340846 0.0053159 0.1524037

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.080
##   Unadjusted ICC: 0.047

i = i+1

2.2.3 aHEIGHT

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aHEIGHT"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.690240   0.011812 143.094   <2e-16 ***
## SEXM         0.116140   0.008851  13.122   <2e-16 ***
## GRPVG        0.007771   0.016002   0.486    0.628    
## GRPVN       -0.005107   0.013838  -0.369    0.713    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F  p-value    
## s(aAGE)  1.001  1.001 0.487 0.486325    
## s(FAM)  41.309 92.000 0.816 0.000701 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.594   Deviance explained = 69.3%
## GCV = 0.0043899  Scale est. = 0.0033027  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 172.188  <2e-16
## GRP  2   0.409   0.665
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F  p-value
## s(aAGE)  1.001  1.001 0.487 0.486325
## s(FAM)  41.309 92.000 0.816 0.000701

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                  Estimate  Std. Error    t value
## (Intercept)  1.6668943452 0.038471017 43.3285749
## GRPVG        0.0046990382 0.016304026  0.2882134
## GRPVN       -0.0078189767 0.014100503 -0.5545176
## SEXM         0.1159475712 0.009069895 12.7837833
## aAGE         0.0006805378 0.001036233  0.6567421


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on body height, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on body height, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.007819 -0.0354555 0.0198175 0.5792247
VG vs OM 0.004699 -0.0272563 0.0366543 0.7731834
VN vs VG -0.012518 -0.0410229 0.0159869 0.3893896

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.280
##   Unadjusted ICC: 0.157

i = i+1

2.2.4 aMASS

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aMASS"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  67.7873     1.9041  35.600   <2e-16 ***
## SEXM         15.6073     1.5450  10.102   <2e-16 ***
## GRPVG        -0.6507     2.5454  -0.256   0.7986    
## GRPVN        -4.4511     2.2031  -2.020   0.0451 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 1.068  0.3031  
## s(FAM)  30.34     92 0.496  0.0133 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.477   Deviance explained = 57.4%
## GCV = 125.83  Scale est. = 102.05    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 102.044  <2e-16
## GRP  2   2.565  0.0803
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 1.068  0.3031
## s(FAM)  30.34  92.00 0.496  0.0133

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  6.06078    0.03621 167.379   <2e-16 ***
## SEXM         0.30900    0.02999  10.305   <2e-16 ***
## GRPVG       -0.01414    0.04822  -0.293   0.7697    
## GRPVN       -0.08683    0.04174  -2.080   0.0392 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 1.282  0.2593  
## s(FAM)  27.11     92 0.420  0.0267 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.474   Deviance explained = 56.2%
## GCV = 0.046573  Scale est. = 0.038575  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 106.183  <2e-16
## GRP  2   2.681  0.0717
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 1.282  0.2593
## s(FAM)  27.11  92.00 0.420  0.0267

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##               Estimate Std. Error   t value
## (Intercept) 60.9689641  6.0073255 10.149103
## GRPVG       -1.3429717  2.3184622 -0.579251
## GRPVN       -3.9016422  2.0098083 -1.941301
## SEXM        15.3633452  1.7035746  9.018299
## aAGE         0.1710179  0.1624228  1.052918


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on body mass, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on body mass, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -3.901642 -7.840794 0.0375097 0.0522218
VG vs OM -1.342972 -5.887074 3.2011308 0.5624198
VN vs VG -2.558671 -6.626369 1.5090278 0.2176280

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.191
##   Unadjusted ICC: 0.122

i = i+1

2.2.5 aHG

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aHG"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  30.8431     1.1568  26.661   <2e-16 ***
## SEXM         21.6728     0.9280  23.354   <2e-16 ***
## GRPVG         1.1900     1.5486   0.768    0.443    
## GRPVN         0.6024     1.3318   0.452    0.652    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  3.915  4.768 1.981  0.0935 .
## s(FAM)  30.549 92.000 0.504  0.0113 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.785   Deviance explained = 82.9%
## GCV = 45.608  Scale est. = 36.176    n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 545.427  <2e-16
## GRP  2   0.296   0.744
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  3.915  4.768 1.981  0.0935
## s(FAM)  30.549 92.000 0.504  0.0113

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##               Estimate Std. Error    t value
## (Intercept) 26.3038005 3.68630971  7.1355373
## GRPVG        1.0621994 1.42147922  0.7472493
## GRPVN        0.5192798 1.23566193  0.4202443
## SEXM        21.8339180 1.04094982 20.9749957
## aAGE         0.1249945 0.09928477  1.2589494


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on hand grip, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on hand grip, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.5192798 -1.902573 2.941133 0.6743070
VG vs OM 1.0621994 -1.723849 3.848247 0.4549131
VN vs VG -0.5429196 -3.024613 1.938774 0.6680827

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.214
##   Unadjusted ICC: 0.059

i = i+1

2.2.6 aPFAT

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aPFAT"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  28.40511    1.09643  25.907   <2e-16 ***
## SEXM        -10.44955    0.89986 -11.612   <2e-16 ***
## GRPVG         0.03024    1.46278   0.021    0.984    
## GRPVN        -1.59845    1.26604  -1.263    0.209    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.054  1.098 2.118  0.1558  
## s(FAM)  28.558 92.000 0.450  0.0212 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.494   Deviance explained = 58.3%
## GCV = 42.279  Scale est. = 34.68     n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 134.848  <2e-16
## GRP  2   1.163   0.315
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.054  1.098 2.118  0.1558
## s(FAM)  28.558 92.000 0.450  0.0212

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

With log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.81850    0.07924  60.809   <2e-16 ***
## SEXM        -0.74686    0.06880 -10.856   <2e-16 ***
## GRPVG       -0.03273    0.10450  -0.313    0.754    
## GRPVN       -0.13062    0.09050  -1.443    0.151    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 2.447  0.1197  
## s(FAM)  18.87     92 0.259  0.0976 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.437   Deviance explained = 50.7%
## GCV = 0.2346  Scale est. = 0.20466   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 117.853  <2e-16
## GRP  2   1.206   0.302
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 2.447  0.1197
## s(FAM)  18.87  92.00 0.259  0.0976

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Did not improve the fit much, lets continue to work with original scale.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate Std. Error      t value
## (Intercept)  23.30037996 3.57040791   6.52597142
## GRPVG        -0.02096941 1.37796025  -0.01521772
## GRPVN        -1.80329491 1.19451420  -1.50964711
## SEXM        -10.40427980 1.01250653 -10.27576563
## aAGE          0.13892100 0.09653475   1.43907759


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on body fat percentage, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on body fat percentage, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -1.8032949 -4.144500 0.5379099 0.1311335
VG vs OM -0.0209694 -2.721722 2.6797831 0.9878585
VN vs VG -1.7823255 -4.199931 0.6352799 0.1484748

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.173
##   Unadjusted ICC: 0.105

i = i+1

2.2.7 aFAT

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aFAT"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  19.6876     1.2280  16.032  < 2e-16 ***
## SEXM         -4.1947     0.9706  -4.322 2.83e-05 ***
## GRPVG         0.3310     1.6493   0.201    0.841    
## GRPVN        -2.2105     1.4271  -1.549    0.124    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE)  1.00      1 1.268  0.2620   
## s(FAM)  34.23     92 0.595  0.0056 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.295   Deviance explained =   44%
## GCV =  50.73  Scale est. = 40.087    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 18.679 2.83e-05
## GRP  2  1.994     0.14
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 1.268  0.2620
## s(FAM)  34.23  92.00 0.595  0.0056

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

With log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.23636    0.10822  39.147  < 2e-16 ***
## SEXM        -0.43864    0.09205  -4.765 4.22e-06 ***
## GRPVG       -0.04587    0.14333  -0.320   0.7494    
## GRPVN       -0.21824    0.12411  -1.758   0.0806 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 2.054  0.1538  
## s(FAM)  22.58     92 0.327  0.0576 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.23   Deviance explained =   34%
## GCV = 0.42832  Scale est. = 0.36515   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 22.706 4.22e-06
## GRP  2  1.845    0.161
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 2.054  0.1538
## s(FAM)  22.58  92.00 0.327  0.0576

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Looks much better after log2-transformation of the outcome variable

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate  Std. Error     t value
## (Intercept)  3.78019421 0.344898009 10.96032484
## GRPVG       -0.01257843 0.133109650 -0.09449675
## GRPVN       -0.19998709 0.115388935 -1.73315659
## SEXM        -0.40721092 0.097807168 -4.16340564
## aAGE         0.01227510 0.009325165  1.31634152


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(body fat weight), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(body fat weight), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.1999871 -0.4261453 0.0261711 0.0830678
VG vs OM -0.0125784 -0.2734686 0.2483117 0.9247146
VN vs VG -0.1874087 -0.4209470 0.0461297 0.1157601

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.131
##   Unadjusted ICC: 0.115

i = i+1

2.2.8 aFFM

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aFFM"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  48.0756     1.0018  47.989   <2e-16 ***
## SEXM         19.6387     0.8596  22.846   <2e-16 ***
## GRPVG        -0.7113     1.3415  -0.530   0.5967    
## GRPVN        -2.1366     1.1435  -1.868   0.0636 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  5.119   6.15 1.815   0.106  
## s(FAM)  21.618  92.00 0.307   0.067 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.772   Deviance explained = 80.8%
## GCV = 37.123  Scale est. = 31.021    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 521.942  <2e-16
## GRP  2   1.912   0.151
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  5.119  6.150 1.815   0.106
## s(FAM)  21.618 92.000 0.307   0.067

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.57401    0.02412 231.126   <2e-16 ***
## SEXM         0.50059    0.02057  24.342   <2e-16 ***
## GRPVG       -0.01057    0.03240  -0.326    0.745    
## GRPVN       -0.05486    0.02753  -1.993    0.048 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  5.808  6.851 1.990  0.0703 .
## s(FAM)  23.182 92.000 0.336  0.0545 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.796   Deviance explained = 83.1%
## GCV = 0.021288  Scale est. = 0.017532  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 592.524  <2e-16
## GRP  2   2.389  0.0951
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  5.808  6.851 1.990  0.0703
## s(FAM)  23.182 92.000 0.336  0.0545

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Looks much better after the log2-transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  5.524849932 0.079280037 69.6877822
## GRPVG       -0.022038004 0.030597271 -0.7202604
## GRPVN       -0.056739829 0.026523896 -2.1391966
## SEXM         0.506876553 0.022482461 22.5454217
## aAGE         0.001379116 0.002143531  0.6433854


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on free fat mass, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on free fat mass, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0567398 -0.1087257 -0.0047539 0.0324197
VG vs OM -0.0220380 -0.0820076 0.0379315 0.4713647
VN vs VG -0.0347018 -0.0883842 0.0189805 0.2051632

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.041
##   Unadjusted ICC: 0.010

i = i+1

2.2.9 aSBP

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aSBP"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  119.512      2.392  49.955  < 2e-16 ***
## SEXM          16.287      2.120   7.681 1.26e-12 ***
## GRPVG         -3.531      3.140  -1.124   0.2625    
## GRPVN         -5.005      2.720  -1.840   0.0676 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00      1 0.659   0.418
## s(FAM)  14.89     92 0.193   0.167
## 
## R-sq.(adj) =  0.317   Deviance explained = 38.6%
## GCV = 218.29  Scale est. = 195.07    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 59.002 1.26e-12
## GRP  2  1.702    0.186
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.659   0.418
## s(FAM)  14.89  92.00 0.193   0.167
plot(gamm, select = 1)

Open code
### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate Std. Error    t value
## (Intercept) 117.17113381  7.8405823 14.9441877
## GRPVG        -3.14998169  3.0259878 -1.0409763
## GRPVN        -4.13054283  2.6231420 -1.5746547
## SEXM         16.92237840  2.2234548  7.6108487
## aAGE          0.03104981  0.2119894  0.1464687


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on systolic blood pressure, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on systolic blood pressure, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -4.1305428 -9.271807 1.010721 0.1153362
VG vs OM -3.1499817 -9.080809 2.780845 0.2978865
VN vs VG -0.9805611 -6.289600 4.328478 0.7173531

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.074
##   Unadjusted ICC: 0.054

i = i+1

2.2.10 aDBP

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aDBP"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   75.704      1.449  52.243  < 2e-16 ***
## SEXM           3.890      1.288   3.019  0.00293 ** 
## GRPVG          2.243      1.901   1.180  0.23959    
## GRPVN         -2.646      1.647  -1.607  0.10999    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00      1 0.908   0.342
## s(FAM)  14.26     92 0.184   0.171
## 
## R-sq.(adj) =  0.166   Deviance explained = 24.8%
## GCV = 80.335  Scale est. = 72.063    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 9.117 0.00293
## GRP  2 4.332 0.01464
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.908   0.342
## s(FAM)  14.26  92.00 0.184   0.171
plot(gamm, select = 1)

Open code
### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept) 73.32003007   4.842061 15.1423201
## GRPVG        1.95773935   1.868741  1.0476249
## GRPVN       -2.32280995   1.619958 -1.4338707
## SEXM         3.73258466   1.373125  2.7183130
## aAGE         0.06993215   0.130917  0.5341716


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on diastolic blood pressure, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on diastolic blood pressure, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -2.322810 -5.497869 0.8522489 0.1516092
VG vs OM 1.957739 -1.704925 5.6204040 0.2948115
VN vs VG -4.280549 -7.559220 -1.0018787 0.0105010

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.073
##   Unadjusted ICC: 0.065

i = i+1

2.2.11 aGLY

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aGLY"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.40512    0.07915  55.657   <2e-16 ***
## SEXM         0.17073    0.07066   2.416   0.0168 *  
## GRPVG        0.02025    0.10468   0.193   0.8468    
## GRPVN       -0.07992    0.08973  -0.891   0.3744    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  3.909  4.838 1.078   0.437
## s(FAM)  13.609 92.000 0.175   0.164
## 
## R-sq.(adj) =  0.126   Deviance explained = 22.2%
## GCV = 0.24205  Scale est. = 0.21419   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 5.838  0.0168
## GRP  2 0.724  0.4865
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  3.909  4.838 1.078   0.437
## s(FAM)  13.609 92.000 0.175   0.164

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformation of the outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.135374   0.024287  87.921   <2e-16 ***
## SEXM         0.051870   0.021048   2.464   0.0148 *  
## GRPVG       -0.002301   0.032364  -0.071   0.9434    
## GRPVN       -0.026463   0.027703  -0.955   0.3409    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  4.236  5.187 1.162  0.3344  
## s(FAM)  19.404 92.000 0.271  0.0784 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.167   Deviance explained = 28.7%
## GCV = 0.022115  Scale est. = 0.018846  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 6.073  0.0148
## GRP  2 0.599  0.5504
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  4.236  5.187 1.162  0.3344
## s(FAM)  19.404 92.000 0.271  0.0784

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  4.330043507 0.215561743 20.0872541
## GRPVG       -0.073920973 0.083193720 -0.8885403
## GRPVN       -0.085287078 0.072118248 -1.1826005
## SEXM         0.146823594 0.061129618  2.4018405
## aAGE         0.002988749 0.005828241  0.5128046


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on glucose level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on glucose level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0852871 -0.2266362 0.0560621 0.2369675
VG vs OM -0.0739210 -0.2369777 0.0891357 0.3742502
VN vs VG -0.0113661 -0.1573279 0.1345957 0.8786954

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.082
##   Unadjusted ICC: 0.078

i = i+1

2.2.12 aTC

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aTC"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   4.9507     0.1405  35.244  < 2e-16 ***
## SEXM         -0.2303     0.1277  -1.803 0.073102 .  
## GRPVG        -0.3664     0.1833  -1.999 0.047131 *  
## GRPVN        -0.5887     0.1588  -3.707 0.000282 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE) 1.000      1 2.166   0.143
## s(FAM)  9.587     92 0.117   0.262
## 
## R-sq.(adj) =  0.135   Deviance explained = 19.8%
## GCV = 0.77105  Scale est. = 0.7109    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 3.252 0.07310
## GRP  2 6.872 0.00134
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.000  1.000 2.166   0.143
## s(FAM)   9.587 92.000 0.117   0.262

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformation of the outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.30210    0.04387  52.480  < 2e-16 ***
## SEXM        -0.08842    0.04005  -2.208   0.0286 *  
## GRPVG       -0.12997    0.05717  -2.273   0.0242 *  
## GRPVN       -0.20140    0.04954  -4.065 7.26e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE) 1.000      1 3.385  0.0675 .
## s(FAM)  8.723     92 0.105  0.2809  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.154   Deviance explained = 21.2%
## GCV = 0.075468  Scale est. = 0.06993   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F  p-value
## SEX  1 4.874 0.028574
## GRP  2 8.265 0.000373
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.000  1.000 3.385  0.0675
## s(FAM)   8.723 92.000 0.105  0.2809

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate  Std. Error   t value
## (Intercept)  2.01221746 0.147841153 13.610672
## GRPVG       -0.14594911 0.057057691 -2.557922
## GRPVN       -0.20523119 0.049461675 -4.149297
## SEXM        -0.08209545 0.041925219 -1.958140
## aAGE         0.00792046 0.003997249  1.981478


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(total cholesterole) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(total cholesterole) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.2052312 -0.3021743 -0.1082881 0.0000333
VG vs OM -0.1459491 -0.2577801 -0.0341181 0.0105300
VN vs VG -0.0592821 -0.1593887 0.0408246 0.2457763

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.039
##   Unadjusted ICC: 0.034

i = i+1

2.2.13 aHDL

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aHDL"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.74986    0.05750  30.431   <2e-16 ***
## SEXM        -0.45602    0.04650  -9.806   <2e-16 ***
## GRPVG       -0.07849    0.07697  -1.020    0.309    
## GRPVN       -0.03907    0.06657  -0.587    0.558    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.328  1.549 3.710  0.0661 .
## s(FAM)  30.824 92.000 0.505  0.0127 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.43   Deviance explained = 53.8%
## GCV = 0.11446  Scale est. = 0.092333  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 96.16  <2e-16
## GRP  2  0.52   0.595
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.328  1.549 3.710  0.0661
## s(FAM)  30.824 92.000 0.505  0.0127

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate  Std. Error    t value
## (Intercept)  1.42352546 0.183953921  7.7384894
## GRPVG       -0.07063416 0.070995023 -0.9949170
## GRPVN       -0.03658183 0.061543548 -0.5944056
## SEXM        -0.42410052 0.052166181 -8.1297981
## aAGE         0.00806825 0.004973646  1.6222002


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on HDL cholesterol level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on HDL cholesterol level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0365818 -0.1572050 0.0840413 0.5522408
VG vs OM -0.0706342 -0.2097818 0.0685135 0.3197766
VN vs VG 0.0340523 -0.0905071 0.1586118 0.5920835

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.188
##   Unadjusted ICC: 0.131

i = i+1

2.2.14 aLDL

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aLDL"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.80560    0.11210  25.028  < 2e-16 ***
## SEXM         0.05931    0.09950   0.596 0.551924    
## GRPVG       -0.24289    0.14709  -1.651 0.100548    
## GRPVN       -0.48219    0.12742  -3.784 0.000214 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00      1 0.807   0.370
## s(FAM)  14.59     92 0.189   0.162
## 
## R-sq.(adj) =  0.157   Deviance explained = 24.1%
## GCV = 0.47997  Scale est. = 0.42969   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F  p-value
## SEX  1 0.355 0.551924
## GRP  2 7.289 0.000922
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.807   0.370
## s(FAM)  14.59  92.00 0.189   0.162

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  2.44318478 0.35753954  6.8333276
## GRPVG       -0.31967964 0.13798851 -2.3167120
## GRPVN       -0.50090939 0.11961828 -4.1875656
## SEXM         0.02200058 0.10139209  0.2169852
## aAGE         0.01044583 0.00966696  1.0805699


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on LDL cholesterol level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on LDL cholesterol level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.5009094 -0.7353569 -0.2664619 0.0000282
VG vs OM -0.3196796 -0.5901322 -0.0492271 0.0205194
VN vs VG -0.1812298 -0.4233280 0.0608685 0.1423248

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.076
##   Unadjusted ICC: 0.069

i = i+1

2.2.15 aTG

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aTG"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.87910    0.09486   9.267  < 2e-16 ***
## SEXM         0.36145    0.07946   4.549 1.08e-05 ***
## GRPVG       -0.10188    0.12619  -0.807    0.421    
## GRPVN       -0.14265    0.10913  -1.307    0.193    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.505   1.82 0.410  0.6353  
## s(FAM)  25.215  92.00 0.382  0.0333 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.238   Deviance explained =   36%
## GCV = 0.3243  Scale est. = 0.27102   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F  p-value
## SEX  1 20.69 1.08e-05
## GRP  2  0.86    0.425
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.505  1.820 0.410  0.6353
## s(FAM)  25.215 92.000 0.382  0.0333

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformation of the outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.38473    0.11244  -3.422 0.000801 ***
## SEXM         0.46812    0.09142   5.121 9.15e-07 ***
## GRPVG       -0.10587    0.15059  -0.703 0.483127    
## GRPVN       -0.14858    0.13007  -1.142 0.255124    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.966  2.424 1.177  0.2659  
## s(FAM)  29.956 92.000 0.488  0.0131 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.297   Deviance explained = 42.9%
## GCV = 0.44134  Scale est. = 0.35656   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 26.221 9.15e-07
## GRP  2  0.657     0.52
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.966  2.424 1.177  0.2659
## s(FAM)  29.956 92.000 0.488  0.0131

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Looks better after log-transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate  Std. Error    t value
## (Intercept) -0.79843363 0.336645341 -2.3717353
## GRPVG       -0.10216949 0.129924623 -0.7863751
## GRPVN       -0.12416055 0.112627926 -1.1023958
## SEXM         0.43015139 0.095466853  4.5057669
## aAGE         0.01035487 0.009102034  1.1376431


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(Triglyceride), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(Triglyceride), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.1241606 -0.3449072 0.0965861 0.2702896
VG vs OM -0.1021695 -0.3568171 0.1524781 0.4316477
VN vs VG -0.0219911 -0.2499414 0.2059593 0.8500272

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.199
##   Unadjusted ICC: 0.175

i = i+1

2.2.16 aCa

Data selection

Open code


column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome)) 

column_name
## [1] "aCa"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 2.426686   0.012353 196.450  < 2e-16 ***
## SEXM        0.051183   0.010275   4.981 1.68e-06 ***
## GRPVG       0.006650   0.016500   0.403    0.688    
## GRPVN       0.005106   0.014229   0.359    0.720    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  2.558  3.166 1.358  0.2312  
## s(FAM)  26.300 92.000 0.405  0.0269 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.255   Deviance explained = 38.3%
## GCV = 0.0054747  Scale est. = 0.0045128  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 24.812 1.68e-06
## GRP  2  0.095     0.91
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  2.558  3.166 1.358  0.2312
## s(FAM)  26.300 92.000 0.405  0.0269

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  2.462634671 0.040767673 60.4065546
## GRPVG        0.008100938 0.015733842  0.5148735
## GRPVN        0.006486519 0.013639216  0.4755786
## SEXM         0.052839772 0.011561014  4.5705137
## aAGE        -0.001061304 0.001102254 -0.9628488


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum calcium level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum calcium level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.0064865 -0.0202459 0.0332189 0.6343746
VG vs OM 0.0081009 -0.0227368 0.0389387 0.6066414
VN vs VG -0.0016144 -0.0292191 0.0259903 0.9087421

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.161
##   Unadjusted ICC: 0.144

i = i+1

2.2.17 aP

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aP"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.193920   0.022760  52.457  < 2e-16 ***
## SEXM        -0.146559   0.020403  -7.183 2.09e-11 ***
## GRPVG        0.001267   0.029857   0.042    0.966    
## GRPVN       -0.029071   0.025818  -1.126    0.262    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.766  2.208 0.859   0.411
## s(FAM)  12.635 92.000 0.159   0.203
## 
## R-sq.(adj) =  0.279   Deviance explained = 34.7%
## GCV = 0.020032  Scale est. = 0.01806   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 51.597 2.09e-11
## GRP  2  0.944    0.391
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.766  2.208 0.859   0.411
## s(FAM)  12.635 92.000 0.159   0.203

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error     t value
## (Intercept)  1.277869210 0.072799038 17.55338056
## GRPVG       -0.001110312 0.028096000 -0.03951849
## GRPVN       -0.030992329 0.024355616 -1.27249212
## SEXM        -0.148820190 0.020644560 -7.20868783
## aAGE        -0.002218743 0.001968301 -1.12723764


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum phosphorous level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum phosphorous level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0309923 -0.0787285 0.0167438 0.2031983
VG vs OM -0.0011103 -0.0561775 0.0539568 0.9684770
VN vs VG -0.0298820 -0.0791759 0.0194119 0.2347813

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.046
##   Unadjusted ICC: 0.035

i = i+1

2.2.18 aMg

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Mg)) 

column_name
## [1] "aMg"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Mg + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Mg + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.813448   0.011287  72.072   <2e-16 ***
## SEXM         0.009663   0.010202   0.947    0.345    
## GRPVG       -0.012224   0.013869  -0.881    0.379    
## GRPVN       -0.007972   0.012105  -0.659    0.511    
## aSUP_Mg      0.004156   0.012763   0.326    0.745    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##               edf Ref.df    F p-value
## s(aAGE) 1.000e+00      1 0.18   0.672
## s(FAM)  1.002e-06     92 0.00   0.572
## 
## R-sq.(adj) =  -0.014   Deviance explained = 1.33%
## GCV = 0.0047049  Scale est. = 0.004554  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Mg + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.897   0.345
## GRP      2 0.411   0.664
## aSUP_Mg  1 0.106   0.745
## 
## Approximate significance of smooth terms:
##               edf    Ref.df    F p-value
## s(aAGE) 1.000e+00 1.000e+00 0.18   0.672
## s(FAM)  1.002e-06 9.200e+01 0.00   0.572

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Mg')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate   Std. Error    t value
## (Intercept)  0.782640171 0.0332342104 23.5492332
## GRPVG       -0.001784129 0.0128253368 -0.1391097
## GRPVN        0.002291817 0.0111942156  0.2047322
## SEXM         0.014742315 0.0094346150  1.5625773
## aAGE         0.000473197 0.0009047637  0.5230061
## aSUP_Mg      0.001214427 0.0118025611  0.1028952


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum magnesium level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum magnesium level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.0022918 -0.0196484 0.0242321 0.8377813
VG vs OM -0.0017841 -0.0269213 0.0233531 0.8893635
VN vs VG 0.0040759 -0.0185350 0.0266869 0.7238553

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Mg'))
## boundary (singular) fit: see help('isSingular')

res2 <- emm(mod_main)
## boundary (singular) fit: see help('isSingular')

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Mg'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Mg'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Mg'),
                  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without other
mod_other_cov <- rlme(type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Mg'),
                type = 'adult')
## boundary (singular) fit: see help('isSingular')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## Warning: Can't compute random effect variances. Some variance components equal
##   zero. Your model may suffer from singularity (see `?lme4::isSingular`
##   and `?performance::check_singularity`).
##   Solution: Respecify random structure! You may also decrease the
##   `tolerance` level to enforce the calculation of random effect variances.
## [1] NA

i = i+1

2.2.19 aSe

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Se)) 

column_name
## [1] "aSe"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Se + 
    s(aAGE) +
    s(FAM, bs='re'), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Se + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.06223    0.06119  17.360   <2e-16 ***
## SEXM        -0.03687    0.03269  -1.128    0.262    
## GRPVG       -0.08043    0.08635  -0.932    0.354    
## GRPVN       -0.06811    0.07409  -0.919    0.360    
## aSUP_Se      0.23479    0.14231   1.650    0.102    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value    
## s(aAGE)  4.84  5.767 1.337   0.341    
## s(FAM)  68.75 92.000 2.767  <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.612   Deviance explained = 77.4%
## GCV = 0.070466  Scale est. = 0.040852  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Se + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 1.273   0.262
## GRP      2 0.552   0.577
## aSUP_Se  1 2.722   0.102
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  4.840  5.767 1.337   0.341
## s(FAM)  68.748 92.000 2.767  <2e-16
plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again with log2-transformed outcome

Open code
gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Se + 
    s(aAGE) +
    s(FAM, bs='re'), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Se + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.05564    0.09008   0.618    0.538
## SEXM        -0.07567    0.04819  -1.570    0.119
## GRPVG       -0.15359    0.12717  -1.208    0.230
## GRPVN       -0.14668    0.10901  -1.345    0.181
## aSUP_Se      0.23895    0.20965   1.140    0.257
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value    
## s(aAGE)  5.319  6.269 1.147   0.354    
## s(FAM)  68.805 92.000 3.013  <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.631   Deviance explained = 78.6%
## GCV = 0.15228  Scale est. = 0.087849  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Se + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 2.465   0.119
## GRP      2 1.061   0.350
## aSUP_Se  1 1.299   0.257
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  5.319  6.269 1.147   0.354
## s(FAM)  68.805 92.000 3.013  <2e-16
plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

The distribution of residuals seem better. Lets continue continue on log-scale

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Se')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                  Estimate  Std. Error     t value
## (Intercept)  0.0276922229 0.216358656  0.12799221
## GRPVG       -0.1614851619 0.123469879 -1.30789114
## GRPVN       -0.1095699976 0.106428421 -1.02951821
## SEXM        -0.0458851521 0.038340344 -1.19678510
## aAGE         0.0004907061 0.005624277  0.08724785
## aSUP_Se      0.1771021236 0.169588671  1.04430398


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum selenium level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum selenium level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.1095700 -0.3181659 0.0990259 0.3032362
VG vs OM -0.1614852 -0.4034817 0.0805114 0.1909102
VN vs VG 0.0519152 -0.1624849 0.2663152 0.6350801

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Se'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Se'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Se'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Se'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Se'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.610
##   Unadjusted ICC: 0.591

i = i+1

2.2.20 aZn

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Zn)) 

column_name
## [1] "aZn"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Zn + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Zn + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  13.9444     0.4593  30.358  < 2e-16 ***
## SEXM          0.6261     0.2717   2.305 0.022943 *  
## GRPVG        -0.9372     0.6315  -1.484 0.140467    
## GRPVN        -1.8437     0.5444  -3.386 0.000963 ***
## aSUP_Zn       0.9758     0.6364   1.533 0.127885    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value    
## s(aAGE)  2.583  3.152 1.105    0.34    
## s(FAM)  61.448 92.000 2.120  <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.566   Deviance explained = 72.4%
## GCV = 4.7176  Scale est. = 2.9761    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Zn + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 5.311 0.02294
## GRP      2 5.832 0.00384
## aSUP_Zn  1 2.351 0.12788
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  2.583  3.152 1.105    0.34
## s(FAM)  61.448 92.000 2.120  <2e-16

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

After log-transformation

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Zn + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Zn + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.78394    0.04745  79.739  < 2e-16 ***
## SEXM         0.06440    0.02860   2.251 0.026190 *  
## GRPVG       -0.10029    0.06509  -1.541 0.125988    
## GRPVN       -0.20640    0.05615  -3.676 0.000356 ***
## aSUP_Zn      0.08062    0.06632   1.216 0.226566    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value    
## s(aAGE)  2.348  2.864 0.997   0.336    
## s(FAM)  60.118 92.000 1.977  <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.554   Deviance explained = 71.4%
## GCV = 0.051838  Scale est. = 0.033136  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Zn + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 5.069 0.02619
## GRP      2 6.917 0.00144
## aSUP_Zn  1 1.477 0.22657
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  2.348  2.864 0.997   0.336
## s(FAM)  60.118 92.000 1.977  <2e-16

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

The distribution of residuals seem better. Lets continue continue on log-scale

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Zn')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  3.887343605 0.126230405 30.7956201
## GRPVG       -0.131065316 0.056579630 -2.3164753
## GRPVN       -0.220903409 0.048961313 -4.5117950
## SEXM         0.065841962 0.027535198  2.3911926
## aAGE        -0.002671081 0.003399141 -0.7858105
## aSUP_Zn      0.065413966 0.060617216  1.0791318


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum log2(zinc) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum log2(zinc) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.2209034 -0.3168658 -0.1249410 0.0000064
VG vs OM -0.1310653 -0.2419594 -0.0201713 0.0205323
VN vs VG -0.0898381 -0.1889434 0.0092672 0.0756192

Leave-one-factor mixed models

Open code



### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Zn'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Zn'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Zn'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Zn'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Zn'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.496
##   Unadjusted ICC: 0.437

i = i+1

2.2.21 aFE

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aFE"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  18.6378     1.3117  14.209  < 2e-16 ***
## SEXM          3.6584     1.1347   3.224  0.00153 ** 
## GRPVG        -1.3003     1.7111  -0.760  0.44840    
## GRPVN         0.1878     1.4924   0.126  0.90002    
## aSUP_Fe      -1.7995     2.0216  -0.890  0.37474    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 0.261  0.6101  
## s(FAM)  20.28     92 0.285  0.0787 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.161   Deviance explained = 27.5%
## GCV = 62.471  Scale est. = 53.693    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F p-value
## SEX      1 10.396 0.00153
## GRP      2  0.497 0.60918
## aSUP_Fe  1  0.792 0.37474
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.261  0.6101
## s(FAM)  20.28  92.00 0.285  0.0787

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.13282    0.10672  38.727  < 2e-16 ***
## SEXM         0.27037    0.09238   2.927  0.00392 ** 
## GRPVG       -0.22027    0.13927  -1.582  0.11570    
## GRPVN       -0.01026    0.12140  -0.085  0.93275    
## aSUP_Fe     -0.11400    0.16456  -0.693  0.48944    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.243  1.426 0.569  0.6077  
## s(FAM)  20.150 92.000 0.282  0.0818 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.162   Deviance explained = 27.6%
## GCV = 0.41415  Scale est. = 0.3557    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 8.565 0.00392
## GRP      2 1.682 0.18918
## aSUP_Fe  1 0.480 0.48944
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.243  1.426 0.569  0.6077
## s(FAM)  20.150 92.000 0.282  0.0818

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation of the outcome did not substantially improve the homogeneity of variance and the normality of residuals. Lets continue with the original scale

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept) 18.18006142  4.0467742  4.4924823
## GRPVG       -2.48750348  1.5549749 -1.5997065
## GRPVN        0.18154880  1.3582558  0.1336632
## SEXM         3.27037151  1.1600157  2.8192476
## aAGE         0.01293276  0.1101416  0.1174194
## aSUP_Fe     -1.83953673  1.9284056 -0.9539159


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum Fe level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum Fe level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.1815488 -2.4805837 2.8436813 0.8936689
VG vs OM -2.4875035 -5.5351983 0.5601913 0.1096637
VN vs VG 2.6690523 -0.0756487 5.4137532 0.0566575

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.116
##   Unadjusted ICC: 0.108

i = i+1

2.2.22 aVKFE

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aVKFE"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  71.4903     1.7914  39.907  < 2e-16 ***
## SEXM         -5.4486     1.3371  -4.075 7.72e-05 ***
## GRPVG         1.5470     2.4045   0.643    0.521    
## GRPVN         2.8019     2.0919   1.339    0.183    
## aSUP_Fe      -0.2508     2.6042  -0.096    0.923    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 0.453 0.501944    
## s(FAM)  42.67     92 0.878 0.000345 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.343   Deviance explained = 51.1%
## GCV = 97.568  Scale est. = 72.174    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 16.605 7.72e-05
## GRP      2  0.903    0.408
## aSUP_Fe  1  0.009    0.923
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 0.453 0.501944
## s(FAM)  42.67  92.00 0.878 0.000345

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  6.147430   0.033283 184.700  < 2e-16 ***
## SEXM        -0.106389   0.026572  -4.004 9.85e-05 ***
## GRPVG        0.029599   0.044150   0.670    0.504    
## GRPVN        0.049308   0.038455   1.282    0.202    
## aSUP_Fe     -0.005837   0.049833  -0.117    0.907    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE)  1.00      1 0.483 0.48803   
## s(FAM)  33.62     92 0.583 0.00588 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.268   Deviance explained =   42%
## GCV = 0.036711  Scale est. = 0.028933  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 16.030 9.85e-05
## GRP      2  0.823    0.441
## aSUP_Fe  1  0.014    0.907
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.483 0.48803
## s(FAM)  33.62  92.00 0.583 0.00588

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation seemingly improved the homogeneity of variance

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  6.075582366 0.095644468 63.5225692
## GRPVG        0.036178181 0.036751432  0.9844019
## GRPVN        0.031635386 0.032102028  0.9854638
## SEXM        -0.100683118 0.027416674 -3.6723316
## aAGE         0.001942899 0.002603168  0.7463596
## aSUP_Fe     -0.032328395 0.045577371 -0.7093080


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum log2(ferritin Fe binding capacity), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum log2(ferritin Fe binding capacity), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.0316354 -0.0312834 0.0945542 0.3243963
VG vs OM 0.0361782 -0.0358533 0.1082097 0.3249179
VN vs VG -0.0045428 -0.0694131 0.0603275 0.8908299

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.220
##   Unadjusted ICC: 0.203

i = i+1

2.2.23 aFERR

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aFERR"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   42.386      7.035   6.025 1.09e-08 ***
## SEXM          42.169      6.168   6.837 1.55e-10 ***
## GRPVG        -24.171      9.159  -2.639  0.00912 ** 
## GRPVN        -34.502      7.980  -4.323 2.67e-05 ***
## aSUP_Fe       14.878     10.893   1.366  0.17385    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.488  1.808 0.264   0.738
## s(FAM)  17.740 92.000 0.242   0.104
## 
## R-sq.(adj) =  0.335   Deviance explained = 41.8%
## GCV = 1825.1  Scale est. = 1588.6    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 46.741 1.55e-10
## GRP      2  9.402 0.000137
## aSUP_Fe  1  1.866 0.173855
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.488  1.808 0.264   0.738
## s(FAM)  17.740 92.000 0.242   0.104

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome - better

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   4.7040     0.1692  27.803  < 2e-16 ***
## SEXM          1.3603     0.1308  10.402  < 2e-16 ***
## GRPVG        -0.5936     0.2261  -2.625   0.0096 ** 
## GRPVN        -0.8608     0.1965  -4.380 2.29e-05 ***
## aSUP_Fe       0.2563     0.2502   1.024   0.3075    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value   
## s(aAGE)  1.744  2.122 0.824 0.50535   
## s(FAM)  38.137 92.000 0.717 0.00159 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.548   Deviance explained = 65.5%
## GCV = 0.91313  Scale est. = 0.69397   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df       F p-value
## SEX      1 108.196 < 2e-16
## GRP      2   9.631 0.00012
## aSUP_Fe  1   1.049 0.30747
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.744  2.122 0.824 0.50535
## s(FAM)  38.137 92.000 0.717 0.00159

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Much better after outcome transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  3.98367629 0.48437215  8.2244123
## GRPVG       -0.54507886 0.18612023 -2.9286385
## GRPVN       -0.74401707 0.16257426 -4.5764753
## SEXM         1.37526662 0.13884622  9.9049624
## aAGE         0.01871669 0.01318322  1.4197363
## aSUP_Fe      0.05755952 0.23081742  0.2493725


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum log2(ferritin) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum log2(ferritin) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.7440171 -1.0626568 -0.4253774 0.0000047
VG vs OM -0.5450789 -0.9098678 -0.1802899 0.0034045
VN vs VG -0.1989382 -0.5274608 0.1295844 0.2352811

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.264
##   Unadjusted ICC: 0.160

i = i+1

2.2.24 aTRF

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aTRF"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.837370   0.071306  39.792  < 2e-16 ***
## SEXM        -0.214291   0.052904  -4.051 8.49e-05 ***
## GRPVG        0.058553   0.095800   0.611    0.542    
## GRPVN        0.110023   0.083337   1.320    0.189    
## aSUP_Fe     -0.009488   0.103362  -0.092    0.927    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value    
## s(aAGE)  1.0      1 0.499 0.48108    
## s(FAM)  43.4     92 0.906 0.00026 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.348   Deviance explained = 51.8%
## GCV = 0.15334  Scale est. = 0.11284   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 16.407 8.49e-05
## GRP      2  0.881    0.417
## aSUP_Fe  1  0.008    0.927
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value
## s(aAGE)  1.0    1.0 0.499 0.48108
## s(FAM)  43.4   92.0 0.906 0.00026

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome - better

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.492311   0.033337  44.765  < 2e-16 ***
## SEXM        -0.105276   0.026460  -3.979 0.000109 ***
## GRPVG        0.028190   0.044269   0.637 0.525257    
## GRPVN        0.048499   0.038555   1.258 0.210415    
## aSUP_Fe     -0.005117   0.049795  -0.103 0.918288    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE)  1.00      1 0.526 0.46934   
## s(FAM)  34.47     92 0.607 0.00469 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.274   Deviance explained = 42.8%
## GCV = 0.036567  Scale est. = 0.028653  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 15.830 0.000109
## GRP      2  0.793 0.454369
## aSUP_Fe  1  0.011 0.918288
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.526 0.46934
## s(FAM)  34.47  92.00 0.607 0.00469

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Much better after the outcome transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  1.419155345 0.095458606 14.8667093
## GRPVG        0.033604406 0.036680015  0.9161503
## GRPVN        0.029896148 0.032039645  0.9330986
## SEXM        -0.099664752 0.027363396 -3.6422655
## aAGE         0.001990978 0.002598109  0.7663180
## aSUP_Fe     -0.030074204 0.045488802 -0.6611342


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on serum log2(transferin) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on serum log2(transferin) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.0298961 -0.0329004 0.0926927 0.3507691
VG vs OM 0.0336044 -0.0382871 0.1054959 0.3595881
VN vs VG -0.0037083 -0.0684525 0.0610360 0.9106189

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.227
##   Unadjusted ICC: 0.210

i = i+1

2.2.25 aSATTRF

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aSATTRF"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 26.29766    2.05742  12.782  < 2e-16 ***
## SEXM         7.51310    1.72073   4.366 2.31e-05 ***
## GRPVG       -2.18168    2.70830  -0.806    0.422    
## GRPVN       -0.01361    2.35702  -0.006    0.995    
## aSUP_Fe     -2.05056    3.13785  -0.653    0.514    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.68   2.06 0.685  0.5277  
## s(FAM)  26.28  92.00 0.402  0.0303 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.231   Deviance explained = 36.3%
## GCV = 148.46  Scale est. = 122.29    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 19.064 2.31e-05
## GRP      2  0.458    0.633
## aSUP_Fe  1  0.427    0.514
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.68   2.06 0.685  0.5277
## s(FAM)  26.28  92.00 0.402  0.0303

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome - not better

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.63208    0.11766  39.368  < 2e-16 ***
## SEXM         0.37999    0.09877   3.847 0.000174 ***
## GRPVG       -0.25266    0.15475  -1.633 0.104553    
## GRPVN       -0.05901    0.13470  -0.438 0.661934    
## aSUP_Fe     -0.10160    0.17967  -0.565 0.572558    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.631  1.994 0.753  0.4914  
## s(FAM)  25.660 92.000 0.388  0.0346 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.219   Deviance explained = 35.1%
## GCV = 0.48747  Scale est. = 0.4033    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 14.801 0.000174
## GRP      2  1.479 0.231104
## aSUP_Fe  1  0.320 0.572558
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.631  1.994 0.753  0.4914
## s(FAM)  25.660 92.000 0.388  0.0346

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

The outcome transformation did not help much

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error     t value
## (Intercept) 26.87526984  6.2058984  4.33060097
## GRPVG       -4.19740872  2.3846194 -1.76020067
## GRPVN       -0.36110427  2.0829425 -0.17336258
## SEXM         6.93260884  1.7789329  3.89706032
## aAGE        -0.01345092  0.1689067 -0.07963522
## aSUP_Fe     -2.62076236  2.9572911 -0.88620372


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on transferin saturation, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on transferin saturation, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.3611043 -4.4435965 3.7213879 0.8623664
VG vs OM -4.1974087 -8.8711769 0.4763595 0.0783738
VN vs VG 3.8363044 -0.3728099 8.0454188 0.0740400

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.146
##   Unadjusted ICC: 0.132

i = i+1

2.2.26 aTRFINDEX

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aTRFINDEX"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.95116    0.05881  16.173  < 2e-16 ***
## SEXM        -0.33494    0.05242  -6.389 1.66e-09 ***
## GRPVG        0.18595    0.07666   2.426  0.01637 *  
## GRPVN        0.18512    0.06661   2.779  0.00609 ** 
## aSUP_Fe     -0.13586    0.09143  -1.486  0.13922    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.467  1.782 0.173   0.772
## s(FAM)  15.006 92.000 0.197   0.148
## 
## R-sq.(adj) =  0.278   Deviance explained = 35.8%
## GCV = 0.12906  Scale est. = 0.11408   n = 185
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 40.824 1.66e-09
## GRP      2  4.464    0.013
## aSUP_Fe  1  2.208    0.139
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.467  1.782 0.173   0.772
## s(FAM)  15.006 92.000 0.197   0.148

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome - better

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.19498    0.07782  -2.506  0.01330 *  
## SEXM        -0.47732    0.06453  -7.397 9.39e-12 ***
## GRPVG        0.30103    0.10350   2.908  0.00419 ** 
## GRPVN        0.27629    0.08944   3.089  0.00240 ** 
## aSUP_Fe     -0.21513    0.11849  -1.816  0.07144 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  3.01  3.706 1.377  0.2956  
## s(FAM)  28.02 92.000 0.447  0.0182 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.397   Deviance explained = 51.2%
## GCV = 0.20984  Scale est. = 0.16896   n = 185
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 54.717 9.39e-12
## GRP      2  5.858  0.00356
## aSUP_Fe  1  3.296  0.07144
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  3.010  3.706 1.377  0.2956
## s(FAM)  28.024 92.000 0.447  0.0182

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Better with log-transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept) -0.097216042 0.248556260 -0.3911229
## GRPVG        0.298259746 0.095977711  3.1075939
## GRPVN        0.246885648 0.083529803  2.9556594
## SEXM        -0.444614135 0.071479584 -6.2201557
## aAGE        -0.003277372 0.006761608 -0.4847031
## aSUP_Fe     -0.121580832 0.118393539 -1.0269212


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(sTfR index - ratio), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(sTfR index - ratio), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.2468856 0.0831702 0.4106011 0.0031200
VG vs OM 0.2982597 0.1101469 0.4863726 0.0018862
VN vs VG -0.0513741 -0.2214201 0.1186719 0.5537556

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.197
##   Unadjusted ICC: 0.147

i = i+1

2.2.27 aSTRF

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Fe)) 

column_name
## [1] "aSTRF"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.1336     0.2032   5.580 8.89e-08 ***
## SEXM          0.1141     0.1910   0.597    0.551    
## GRPVG         0.1040     0.2609   0.399    0.691    
## GRPVN         0.2433     0.2265   1.074    0.284    
## aSUP_Fe      -0.2486     0.3199  -0.777    0.438    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE) 1.000      1 0.121   0.728
## s(FAM)  2.855     92 0.032   0.424
## 
## R-sq.(adj) =  0.00105   Deviance explained = 4.35%
## GCV =  1.619  Scale est. = 1.5419    n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.357   0.551
## GRP      2 0.601   0.550
## aSUP_Fe  1 0.604   0.438
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.000  1.000 0.121   0.728
## s(FAM)   2.855 92.000 0.032   0.424

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Fe + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.231691   0.066562   3.481 0.000631 ***
## SEXM        -0.001934   0.061939  -0.031 0.975122    
## GRPVG        0.105664   0.085709   1.233 0.219295    
## GRPVN        0.087213   0.074413   1.172 0.242789    
## aSUP_Fe     -0.195472   0.104562  -1.869 0.063236 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##         edf Ref.df     F p-value
## s(aAGE) 1.0      1 0.232   0.631
## s(FAM)  5.3     92 0.061   0.367
## 
## R-sq.(adj) =  0.0301   Deviance explained = 8.41%
## GCV = 0.17222  Scale est. = 0.16175   n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Fe + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.001  0.9751
## GRP      2 0.940  0.3927
## aSUP_Fe  1 3.495  0.0632
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value
## s(aAGE)  1.0    1.0 0.232   0.631
## s(FAM)   5.3   92.0 0.061   0.367

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Seems better with log-transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Fe')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  0.175287099 0.160494719  1.0921674
## GRPVG        0.098721009 0.061995489  1.5923902
## GRPVN        0.038502452 0.053833496  0.7152137
## SEXM        -0.021711556 0.046076149 -0.4712103
## aAGE         0.001874805 0.004366848  0.4293269
## aSUP_Fe     -0.160991370 0.076451202 -2.1058056


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(soluble transferon receptor), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(soluble transferon receptor), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.0385025 -0.0670093 0.1440142 0.4744770
VG vs OM 0.0987210 -0.0227879 0.2202299 0.1112971
VN vs VG -0.0602186 -0.1698312 0.0493941 0.2815889

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Fe'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Fe'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Fe'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Fe'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Fe'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.014
##   Unadjusted ICC: 0.013

i = i+1

2.2.28 aHGB

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aHGB"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  136.931      2.067   66.26   <2e-16 ***
## SEXM          17.346      1.759    9.86   <2e-16 ***
## GRPVG         -1.313      2.737   -0.48    0.632    
## GRPVN         -2.394      2.370   -1.01    0.314    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.074  1.135 1.520  0.2400  
## s(FAM)  22.439 92.000 0.325  0.0569 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.406   Deviance explained = 49.1%
## GCV = 156.38  Scale est. = 133.37    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F p-value
## SEX  1 97.211  <2e-16
## GRP  2  0.514   0.599
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.074  1.135 1.520  0.2400
## s(FAM)  22.439 92.000 0.325  0.0569

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept) 142.4861828   5.114829 27.8574701
## GRPVG        -1.1030400   1.974013 -0.5587806
## GRPVN        -1.0930815   1.711215 -0.6387751
## SEXM         18.1167604   1.450478 12.4902021
## aAGE         -0.1694821   0.138292 -1.2255383


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on hemoglobin level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on hemoglobin level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -1.0930815 -4.447001 2.260838 0.5229692
VG vs OM -1.1030400 -4.972034 2.765954 0.5763114
VN vs VG 0.0099585 -3.453410 3.473327 0.9955034

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.131
##   Unadjusted ICC: 0.088

i = i+1

2.2.29 aMCV

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aMCV"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  89.1372     0.6604 134.968  < 2e-16 ***
## SEXM         -1.6668     0.6198  -2.689  0.00783 ** 
## GRPVG        -0.9380     0.8546  -1.098  0.27388    
## GRPVN         1.0481     0.7408   1.415  0.15883    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE) 1.000      1 1.037   0.310
## s(FAM)  2.481     92 0.028   0.432
## 
## R-sq.(adj) =  0.0627   Deviance explained = 9.53%
## GCV = 17.521  Scale est. = 16.82     n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 7.233 0.00783
## GRP  2 3.509 0.03200
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.000  1.000 1.037   0.310
## s(FAM)   2.481 92.000 0.028   0.432

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error   t value
## (Intercept) 86.51614413 1.84167801 46.976802
## GRPVG       -0.81659870 0.71077568 -1.148884
## GRPVN        1.65981932 0.61615104  2.693851
## SEXM        -1.17976077 0.52226834 -2.258917
## aAGE         0.05637678 0.04979429  1.132194


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on mean corpuscular volume, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on mean corpuscular volume, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 1.6598193 0.4521855 2.867453 0.0070632
VG vs OM -0.8165987 -2.2096934 0.576496 0.2506039
VN vs VG 2.4764180 1.2293754 3.723461 0.0000994

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')
## boundary (singular) fit: see help('isSingular')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.000
##   Unadjusted ICC: 0.000

i = i+1

2.2.30 aPTH

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aPTH"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3.1794     0.1926  16.508   <2e-16 ***
## SEXM         -0.1709     0.1596  -1.071   0.2860    
## GRPVG        -0.1681     0.2564  -0.656   0.5130    
## GRPVN         0.4819     0.2220   2.171   0.0315 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 1.244  0.2664  
## s(FAM)  26.99     92 0.418  0.0268 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.209   Deviance explained = 34.1%
## GCV = 1.3187  Scale est. = 1.0931    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 1.146 0.28603
## GRP  2 4.803 0.00946
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 1.244  0.2664
## s(FAM)  26.99  92.00 0.418  0.0268

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.567467   0.086576  18.105   <2e-16 ***
## SEXM        -0.005991   0.067575  -0.089   0.9295    
## GRPVG       -0.086925   0.116526  -0.746   0.4569    
## GRPVN        0.175315   0.100814   1.739   0.0841 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE)  1.00      1 0.915 0.34047   
## s(FAM)  35.99     92 0.647 0.00334 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.269   Deviance explained = 42.6%
## GCV = 0.24834  Scale est. = 0.19391   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 0.008   0.929
## GRP  2 3.591   0.030
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.915 0.34047
## s(FAM)  35.99  92.00 0.647 0.00334

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Not substantially better

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  2.34084694 0.56786353  4.1221998
## GRPVG       -0.15111251 0.21916078 -0.6895052
## GRPVN        0.36768227 0.18998419  1.9353309
## SEXM        -0.03930107 0.16103637 -0.2440509
## aAGE         0.02080269 0.01535359  1.3549079


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on parathormone level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on parathormone level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.3676823 -0.0046799 0.7400444 0.0529497
VG vs OM -0.1511125 -0.5806597 0.2784347 0.4905054
VN vs VG 0.5187948 0.1342813 0.9033082 0.0081829

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.164
##   Unadjusted ICC: 0.154

i = i+1

2.2.31 aCros

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Ca), 
         !is.na(aSUP_D)) 

column_name
## [1] "aCros"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    aSUP_D +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.425831   0.038721  10.997   <2e-16 ***
## SEXM        -0.011581   0.034635  -0.334    0.738    
## GRPVG       -0.045738   0.049547  -0.923    0.357    
## GRPVN       -0.000450   0.043210  -0.010    0.992    
## aSUP_Ca      0.009751   0.068515   0.142    0.887    
## aSUP_D       0.048733   0.037304   1.306    0.193    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##               edf Ref.df     F p-value   
## s(aAGE) 2.291e+00  2.929 5.898 0.00112 **
## s(FAM)  1.178e-07 92.000 0.000 0.54873   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0879   Deviance explained = 12.4%
## GCV = 0.054416  Scale est. = 0.052004  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.112   0.738
## GRP      2 0.645   0.526
## aSUP_Ca  1 0.020   0.887
## aSUP_D   1 1.707   0.193
## 
## Approximate significance of smooth terms:
##               edf    Ref.df     F p-value
## s(aAGE) 2.291e+00 2.929e+00 5.898 0.00112
## s(FAM)  1.178e-07 9.200e+01 0.000 0.54873

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome - better

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    aSUP_D +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, 
##     bs = "re")
## 
## Parametric coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.4809125  0.1308232 -11.320   <2e-16 ***
## SEXM         0.0691562  0.1161445   0.595    0.552    
## GRPVG       -0.1307583  0.1675505  -0.780    0.436    
## GRPVN        0.0002462  0.1462614   0.002    0.999    
## aSUP_Ca      0.0206799  0.2307594   0.090    0.929    
## aSUP_D       0.1429459  0.1261068   1.134    0.259    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE) 1.951  2.487 5.742  0.0023 **
## s(FAM)  1.741 92.000 0.019  0.4349   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0736   Deviance explained = 11.7%
## GCV = 0.61672  Scale est. = 0.58476   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, 
##     bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.355   0.552
## GRP      2 0.469   0.627
## aSUP_Ca  1 0.008   0.929
## aSUP_D   1 1.285   0.259
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.951  2.487 5.742  0.0023
## s(FAM)   1.741 92.000 0.019  0.4349

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Seems better with log-transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Ca', 'aSUP_D')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept) -0.27779683 0.40465400 -0.6865046
## GRPVG       -0.10107124 0.16246134 -0.6221249
## GRPVN        0.05109413 0.14220856  0.3592901
## SEXM         0.12850192 0.11385367  1.1286586
## aAGE        -0.03412457 0.01086923 -3.1395570
## aSUP_Ca      0.18519948 0.22425288  0.8258510
## aSUP_D       0.08029725 0.12283772  0.6536856


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(beta-CrossLaps) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(beta-CrossLaps) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.0510941 -0.2276295 0.3298178 0.7193781
VG vs OM -0.1010712 -0.4194896 0.2173471 0.5338598
VN vs VG 0.1521654 -0.1200353 0.4243661 0.2732289

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Ca', 'aSUP_D'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Ca', 'aSUP_D'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Ca', 'aSUP_D'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Ca', 'aSUP_D'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Ca', 'aSUP_D'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.012
##   Unadjusted ICC: 0.011

i = i+1

2.2.32 aP1NP

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_Ca), 
         !is.na(aSUP_D)) 

column_name
## [1] "aP1NP"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    aSUP_D +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  48.2496     4.0177  12.009   <2e-16 ***
## SEXM         -3.7322     3.5904  -1.039   0.3000    
## GRPVG         0.7933     5.1232   0.155   0.8771    
## GRPVN         6.9323     4.4846   1.546   0.1239    
## aSUP_Ca      -5.3566     7.0718  -0.757   0.4498    
## aSUP_D        7.9271     3.8737   2.046   0.0422 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##               edf Ref.df     F p-value   
## s(aAGE) 1.000e+00      1 6.934 0.00919 **
## s(FAM)  2.443e-09     94 0.000 0.67144   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0832   Deviance explained = 11.3%
## GCV = 583.01  Scale est. = 561.19    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 1.081  0.3000
## GRP      2 1.638  0.1972
## aSUP_Ca  1 0.574  0.4498
## aSUP_D   1 4.188  0.0422
## 
## Approximate significance of smooth terms:
##               edf    Ref.df     F p-value
## s(aAGE) 1.000e+00 1.000e+00 6.934 0.00919
## s(FAM)  2.443e-09 9.400e+01 0.000 0.67144

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome - better

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    aSUP_D +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, 
##     bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.459829   0.096778  56.416   <2e-16 ***
## SEXM        -0.001644   0.086485  -0.019    0.985    
## GRPVG        0.024800   0.123409   0.201    0.841    
## GRPVN        0.153014   0.108024   1.416    0.158    
## aSUP_Ca     -0.115319   0.170347  -0.677    0.499    
## aSUP_D       0.178770   0.093310   1.916    0.057 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##               edf Ref.df     F p-value   
## s(aAGE) 1.000e+00      1 8.353 0.00432 **
## s(FAM)  1.416e-08     92 0.000 0.57808   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0714   Deviance explained = 10.1%
## GCV = 0.33828  Scale est. = 0.32562   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + aSUP_D + s(aAGE) + s(FAM, 
##     bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.000   0.985
## GRP      2 1.315   0.271
## aSUP_Ca  1 0.458   0.499
## aSUP_D   1 3.671   0.057
## 
## Approximate significance of smooth terms:
##               edf    Ref.df     F p-value
## s(aAGE) 1.000e+00 1.000e+00 8.353 0.00432
## s(FAM)  1.416e-08 9.200e+01 0.000 0.57808

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Seems better after log-transformation

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Ca', 'aSUP_D')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error     t value
## (Intercept)  6.302159016 0.330844280 19.04871685
## GRPVG        0.008317194 0.132828059  0.06261624
## GRPVN        0.136865071 0.116269427  1.17713723
## SEXM         0.028827929 0.093086525  0.30968960
## aAGE        -0.024181575 0.008886661 -2.72110910
## aSUP_Ca     -0.101822423 0.183348697 -0.55534850
## aSUP_D       0.177087095 0.100431868  1.76325600


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(procollagen type I) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(procollagen type I) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.1368651 -0.0910188 0.3647490 0.2391407
VG vs OM 0.0083172 -0.2520210 0.2686554 0.9500721
VN vs VG 0.1285479 -0.0940029 0.3510986 0.2575933

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Ca', 'aSUP_D'))
## boundary (singular) fit: see help('isSingular')

res2 <- emm(mod_main)
## boundary (singular) fit: see help('isSingular')

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Ca', 'aSUP_D'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Ca', 'aSUP_D'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Ca', 'aSUP_D'),
                  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without other
mod_other_cov <- rlme(type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Ca', 'aSUP_D'),
                type = 'adult')
## boundary (singular) fit: see help('isSingular')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## Warning: Can't compute random effect variances. Some variance components equal
##   zero. Your model may suffer from singularity (see `?lme4::isSingular`
##   and `?performance::check_singularity`).
##   Solution: Respecify random structure! You may also decrease the
##   `tolerance` level to enforce the calculation of random effect variances.
## [1] NA

i = i+1

2.2.33 aUI

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome)) 

column_name
## [1] "aUI"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 137.9724    22.6542   6.090 1.43e-08 ***
## SEXM          0.8798    15.4427   0.057    0.955    
## GRPVG       -29.4705    30.8797  -0.954    0.342    
## GRPVN        -3.5951    26.4988  -0.136    0.892    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 3.554   0.0618 .  
## s(FAM)  45.27     84 1.211 2.58e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.383   Deviance explained = 56.4%
## GCV =  12535  Scale est. = 8806.9    n = 169
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 0.003   0.955
## GRP  2 0.577   0.563
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 3.554   0.0618
## s(FAM)  45.27  84.00 1.211 2.58e-05

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   6.9473     0.3352  20.727   <2e-16 ***
## SEXM         -0.1768     0.1556  -1.136    0.259    
## GRPVG        -0.7849     0.4745  -1.654    0.101    
## GRPVN        -0.5123     0.4030  -1.271    0.207    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value    
## s(aAGE)  4.732  5.661 1.221     0.3    
## s(FAM)  67.786 84.000 3.969  <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.683   Deviance explained = 82.5%
## GCV = 1.4734  Scale est. = 0.80628   n = 169
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 1.290   0.259
## GRP  2 1.453   0.239
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  4.732  5.661 1.221     0.3
## s(FAM)  67.786 84.000 3.969  <2e-16

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Transformation did substantially improve the residuals distribution

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome) 
column_name <- paste0('log2_', column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  5.87765312 0.72041473  8.1587076
## GRPVG       -0.51177760 0.34210167 -1.4959810
## GRPVN       -0.41039200 0.29232831 -1.4038736
## SEXM        -0.09179391 0.14190622 -0.6468632
## aAGE         0.02899618 0.01910877  1.5174274


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on urinary iodine level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on urinary iodine level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.4103920 -0.9833450 0.1625610 0.1603565
VG vs OM -0.5117776 -1.1822846 0.1587294 0.1346586
VN vs VG 0.1013856 -0.4838616 0.6866328 0.7342065

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.653
##   Unadjusted ICC: 0.622

i = i+1

2.2.34 aUREA

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aUREA"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.38411    0.20867  21.010  < 2e-16 ***
## SEXM         0.66433    0.18762   3.541 0.000522 ***
## GRPVG        0.09245    0.27878   0.332 0.740603    
## GRPVN       -0.73765    0.23468  -3.143 0.001990 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value   
## s(aAGE)  7.467  8.333 3.601 0.00101 **
## s(FAM)  14.727 92.000 0.193 0.14311   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.319   Deviance explained = 41.1%
## GCV = 1.6659  Scale est. = 1.4325    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 12.538 0.000522
## GRP  2  7.846 0.000561
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  7.467  8.333 3.601 0.00101
## s(FAM)  14.727 92.000 0.193 0.14311

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.09327    0.06268  33.394  < 2e-16 ***
## SEXM         0.23203    0.05352   4.335 2.61e-05 ***
## GRPVG       -0.02983    0.08407  -0.355 0.723235    
## GRPVN       -0.27819    0.07159  -3.886 0.000151 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  5.341  6.378 1.604  0.1320  
## s(FAM)  22.633 92.000 0.331  0.0484 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.335   Deviance explained = 44.6%
## GCV = 0.14441  Scale est. = 0.11972   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 18.795 2.61e-05
## GRP  2  9.733 0.000104
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  5.341  6.378 1.604  0.1320
## s(FAM)  22.633 92.000 0.331  0.0484

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation improved the fit. We will continue to work with log-transformed values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error   t value
## (Intercept)  1.869322448 0.204511767  9.140415
## GRPVG       -0.099980430 0.078929101 -1.266712
## GRPVN       -0.293105027 0.068421372 -4.283823
## SEXM         0.221267918 0.057996034  3.815225
## aAGE         0.007131657 0.005529478  1.289752


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(urea) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(urea) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.2931050 -0.4272085 -0.1590016 0.0000184
VG vs OM -0.0999804 -0.2546786 0.0547178 0.2052583
VN vs VG -0.1931246 -0.3316042 -0.0546450 0.0062688

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.141
##   Unadjusted ICC: 0.112

i = i+1

2.2.35 aCREA

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aCREA"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  62.7561     1.8846  33.299  < 2e-16 ***
## SEXM         15.1981     1.5792   9.624  < 2e-16 ***
## GRPVG        -0.9574     2.5548  -0.375  0.70839    
## GRPVN        -5.9688     2.1520  -2.774  0.00626 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F  p-value    
## s(aAGE)  7.868  8.537 3.784 0.000436 ***
## s(FAM)  27.785 92.000 0.433 0.024844 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.53   Deviance explained = 62.8%
## GCV = 125.65  Scale est. = 99.004    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F p-value
## SEX  1 92.623  <2e-16
## GRP  2  4.745  0.0101
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F  p-value
## s(aAGE)  7.868  8.537 3.784 0.000436
## s(FAM)  27.785 92.000 0.433 0.024844

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.94520    0.03825 155.411  < 2e-16 ***
## SEXM         0.33174    0.03098  10.709  < 2e-16 ***
## GRPVG       -0.03510    0.05211  -0.674  0.50172    
## GRPVN       -0.12775    0.04398  -2.904  0.00427 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value   
## s(aAGE)  7.683  8.399 2.994 0.00320 **
## s(FAM)  32.914 92.000 0.556 0.00872 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.563   Deviance explained = 66.6%
## GCV = 0.049779  Scale est. = 0.037908  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 114.673 < 2e-16
## GRP  2   4.794 0.00966
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  7.683  8.399 2.994 0.00320
## s(FAM)  32.914 92.000 0.556 0.00872

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation improved the fit. We will continue to work with log-transformed values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  5.844416510 0.119777686 48.7938671
## GRPVG       -0.073863948 0.046226901 -1.5978564
## GRPVN       -0.132356761 0.040072773 -3.3029099
## SEXM         0.332572418 0.033966900  9.7910735
## aAGE         0.002980323 0.003238484  0.9202833


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(creatinine) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(creatinine) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.1323568 -0.210898 -0.0538156 0.0009569
VG vs OM -0.0738639 -0.164467 0.0167391 0.1100749
VN vs VG -0.0584928 -0.139597 0.0226114 0.1574980

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.133
##   Unadjusted ICC: 0.080

i = i+1

2.2.36 aUA

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

column_name
## [1] "aUA"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  262.773      9.237  28.448   <2e-16 ***
## SEXM          89.682      8.112  11.056   <2e-16 ***
## GRPVG         -5.856     12.150  -0.482    0.630    
## GRPVN         -7.832     10.525  -0.744    0.458    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value  
## s(aAGE)  1.0      1 4.897  0.0283 *
## s(FAM)  16.7     92 0.223  0.1258  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.431   Deviance explained = 49.4%
## GCV = 3224.7  Scale est. = 2850.5    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df       F p-value
## SEX  1 122.237  <2e-16
## GRP  2   0.281   0.756
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F p-value
## s(aAGE)  1.0    1.0 4.897  0.0283
## s(FAM)  16.7   92.0 0.223  0.1258

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##               Estimate Std. Error    t value
## (Intercept) 336.068816 31.0908339 10.8092571
## GRPVG        -8.029163 11.9991705 -0.6691431
## GRPVN        -5.573346 10.4017366 -0.5358092
## SEXM         91.199419  8.8168280 10.3437902
## aAGE         -2.117551  0.8406171 -2.5190432


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on uric acid level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on uric acid level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -5.573346 -25.96037 14.81368 0.5920905
VG vs OM -8.029163 -31.54710 15.48878 0.5034042
VN vs VG 2.455817 -18.59650 23.50814 0.8191520

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.091
##   Unadjusted ICC: 0.057

i = i+1

2.2.37 aVIT_AKTB12

Data selection

Open code

## data selection
column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSup_B12)) 

column_name
## [1] "aVIT_AKTB12"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSup_B12 + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  106.955     10.662  10.032   <2e-16 ***
## SEXM         -21.083      8.720  -2.418   0.0168 *  
## GRPVG        -26.469     15.606  -1.696   0.0919 .  
## GRPVN         -7.692     16.161  -0.476   0.6348    
## aSup_B12      22.701     13.170   1.724   0.0868 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 1.524  0.2189  
## s(FAM)  28.77     92 0.459  0.0187 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.226   Deviance explained = 36.6%
## GCV = 3999.1  Scale est. = 3255.4    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df     F p-value
## SEX       1 5.845  0.0168
## GRP       2 1.774  0.1732
## aSup_B12  1 2.971  0.0868
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 1.524  0.2189
## s(FAM)  28.77  92.00 0.459  0.0187

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSup_B12 + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  6.60198    0.11983  55.094  < 2e-16 ***
## SEXM        -0.25397    0.08038  -3.159  0.00197 ** 
## GRPVG       -0.36448    0.17827  -2.044  0.04295 *  
## GRPVN       -0.14558    0.18137  -0.803  0.42367    
## aSup_B12     0.22160    0.14090   1.573  0.11823    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F  p-value    
## s(aAGE)  1.0      1 0.023    0.879    
## s(FAM)  52.7     92 1.355 4.34e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.444   Deviance explained = 61.7%
## GCV = 0.38929  Scale est. = 0.2671    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df     F p-value
## SEX       1 9.982 0.00197
## GRP       2 2.302 0.10421
## aSup_B12  1 2.474 0.11823
## 
## Approximate significance of smooth terms:
##          edf Ref.df     F  p-value
## s(aAGE)  1.0    1.0 0.023    0.879
## s(FAM)  52.7   92.0 1.355 4.34e-06

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation improved the fit. We will continue to work with log-transformed values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSup_B12')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                  Estimate  Std. Error     t value
## (Intercept)  6.5532171286 0.340046293 19.27154409
## GRPVG       -0.2998320029 0.165966435 -1.80658217
## GRPVN       -0.0870977097 0.168498428 -0.51690518
## SEXM        -0.2300316762 0.073237971 -3.14087999
## aAGE        -0.0001034442 0.009109077 -0.01135617
## aSup_B12     0.1963498001 0.130122583  1.50896021


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(vitamin B12) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(vitamin B12) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0870977 -0.4173486 0.2431531 0.6052224
VG vs OM -0.2998320 -0.6251202 0.0254562 0.0708275
VN vs VG 0.2127343 -0.0667704 0.4922390 0.1357643

Leave-one-factor mixed models

Open code

### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSup_B12'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSup_B12'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSup_B12'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSup_B12'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSup_B12'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.400
##   Unadjusted ICC: 0.369

i = i+1

2.2.38 aHCY

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSup_B12))

column_name
## [1] "aHCY"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSup_B12 +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 13.71028    1.19478  11.475  < 2e-16 ***
## SEXM         6.95489    1.10957   6.268  4.1e-09 ***
## GRPVG       -0.05966    1.83444  -0.033    0.974    
## GRPVN       -1.42550    1.88299  -0.757    0.450    
## aSup_B12    -0.28000    1.59650  -0.175    0.861    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.345  1.593 0.945   0.501
## s(FAM)  14.323 82.000 0.215   0.138
## 
## R-sq.(adj) =  0.254   Deviance explained = 34.5%
## GCV = 53.027  Scale est. = 46.304    n = 163
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df      F p-value
## SEX       1 39.289 4.1e-09
## GRP       2  0.439   0.646
## aSup_B12  1  0.031   0.861
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.345  1.593 0.945   0.501
## s(FAM)  14.323 82.000 0.215   0.138

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSup_B12 +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.685806   0.073061  50.448  < 2e-16 ***
## SEXM         0.552059   0.062247   8.869  5.3e-15 ***
## GRPVG        0.043697   0.113526   0.385    0.701    
## GRPVN       -0.095224   0.115761  -0.823    0.412    
## aSup_B12     0.005408   0.096473   0.056    0.955    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.921   2.36 1.125  0.3336  
## s(FAM)  27.472  82.00 0.520  0.0123 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.448   Deviance explained = 56.2%
## GCV = 0.18113  Scale est. = 0.14291   n = 163
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df      F p-value
## SEX       1 78.656 5.3e-15
## GRP       2  0.966   0.383
## aSup_B12  1  0.003   0.955
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.921  2.360 1.125  0.3336
## s(FAM)  27.472 82.000 0.520  0.0123

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation slightly improved the fit. As log2 transformation was used in children category, we will continue to work with log-transformed values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       include = c('aSup_B12'),
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error     t value
## (Intercept)  3.524246411 0.200539051 17.57386602
## GRPVG        0.105167460 0.088104632  1.19366551
## GRPVN       -0.042892250 0.090826370 -0.47224446
## SEXM         0.481593485 0.058124036  8.28561679
## aAGE         0.003485828 0.005441813  0.64056374
## aSup_B12     0.002687899 0.078039153  0.03444295


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(homocystain), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(homocystain), estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.0428923 -0.2209087 0.1351242 0.6367523
VG vs OM 0.1051675 -0.0675144 0.2778494 0.2326088
VN vs VG -0.1480597 -0.3006219 0.0045024 0.0571553

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  include = c('aSup_B12'),
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  include = c('aSup_B12'),
  type = 'adult')

### model without sex
mod_nsex <- rlme(
  exclude = c('SEX'),
  include = c('aSup_B12'),
  type = 'adult')
## boundary (singular) fit: see help('isSingular')

### model without diet groups
mod_ndiet <- rlme(
  exclude = c('GRP'),
  include = c('aSup_B12'),
  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(
  exclude = c('aAGE'),
  include = c('aSup_B12'),
  type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## boundary (singular) fit: see help('isSingular')
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.213
##   Unadjusted ICC: 0.148

i = i+1

2.2.39 aMMA

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSup_B12))

column_name
## [1] "aMMA"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSup_B12 +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   165.03      71.01   2.324   0.0212 *
## SEXM           69.52      67.29   1.033   0.3029  
## GRPVG         163.59     101.37   1.614   0.1083  
## GRPVN         256.32     106.04   2.417   0.0166 *
## aSup_B12     -227.21      88.76  -2.560   0.0113 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##               edf Ref.df     F p-value
## s(aAGE) 1.000e+00      1 1.779   0.184
## s(FAM)  4.556e-09     93 0.000   0.590
## 
## R-sq.(adj) =  0.035   Deviance explained =  6.1%
## GCV = 2.0516e+05  Scale est. = 1.9858e+05  n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df     F p-value
## SEX       1 1.068  0.3029
## GRP       2 2.922  0.0564
## aSup_B12  1 6.553  0.0113
## 
## Approximate significance of smooth terms:
##               edf    Ref.df     F p-value
## s(aAGE) 1.000e+00 1.000e+00 1.779   0.184
## s(FAM)  4.556e-09 9.300e+01 0.000   0.590

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

log2 outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSup_B12 +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.52010    0.10523  71.463  < 2e-16 ***
## SEXM         0.17721    0.08985   1.972 0.050298 .  
## GRPVG        0.46768    0.15317   3.053 0.002654 ** 
## GRPVN        0.30704    0.15908   1.930 0.055375 .  
## aSup_B12    -0.45949    0.13077  -3.514 0.000575 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  1.112  1.203 2.450  0.1332  
## s(FAM)  21.627 92.000 0.307  0.0717 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.239   Deviance explained = 34.8%
## GCV = 0.40864  Scale est. = 0.34802   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSup_B12 + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df      F  p-value
## SEX       1  3.890 0.050298
## GRP       2  4.664 0.010754
## aSup_B12  1 12.347 0.000575
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.112  1.203 2.450  0.1332
## s(FAM)  21.627 92.000 0.307  0.0717

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation slightly improved the fit. As log2 transformation was used in children category, we will continue to work with log-transformed values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       include = c('aSup_B12'),
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate  Std. Error   t value
## (Intercept)  6.95490719 0.261011596 26.645970
## GRPVG        0.40509058 0.110962983  3.650682
## GRPVN        0.14131703 0.116073344  1.217480
## SEXM         0.09687987 0.073651193  1.315388
## aAGE         0.01641409 0.007052435  2.327435
## aSup_B12    -0.33754307 0.097155351 -3.474261


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(methylmalonic acid) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(methylmalonic acid) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.1413170 -0.0861825 0.3688166 0.2234215
VG vs OM 0.4050906 0.1876071 0.6225740 0.0002615
VN vs VG -0.2637736 -0.4488089 -0.0787382 0.0052062

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  include = c('aSup_B12'),
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  include = c('aSup_B12'),
  type = 'adult')

### model without sex
mod_nsex <- rlme(
  exclude = c('SEX'),
  include = c('aSup_B12'),
  type = 'adult')

### model without diet groups
mod_ndiet <- rlme(
  exclude = c('GRP'),
  include = c('aSup_B12'),
  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(
  exclude = c('aAGE'),
  include = c('aSup_B12'),
  type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.119
##   Unadjusted ICC: 0.101

i = i+1

2.2.40 aVIT_D

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_D)) 

column_name
## [1] "aVIT_D"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_D + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   66.392      4.110  16.155   <2e-16 ***
## SEXM           0.103      2.779   0.037   0.9705    
## GRPVG          4.886      5.517   0.886   0.3774    
## GRPVN         11.269      4.777   2.359   0.0198 *  
## aSUP_D         3.179      3.821   0.832   0.4069    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 0.888    0.348    
## s(FAM)  46.16     92 1.021 8.77e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.369   Deviance explained = 54.3%
## GCV = 446.75  Scale est. = 322.15    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##        df     F p-value
## SEX     1 0.001  0.9705
## GRP     2 2.977  0.0543
## aSUP_D  1 0.692  0.4069
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 0.888    0.348
## s(FAM)  46.16  92.00 1.021 8.77e-05

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_D + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.97256    0.07822  76.355  < 2e-16 ***
## SEXM        -0.01146    0.05437  -0.211  0.83338    
## GRPVG        0.11505    0.10460   1.100  0.27327    
## GRPVN        0.24280    0.09061   2.680  0.00826 ** 
## aSUP_D       0.08500    0.07310   1.163  0.24695    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 0.837 0.361721    
## s(FAM)  42.98     92 0.888 0.000325 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.354   Deviance explained = 52.1%
## GCV = 0.16789  Scale est. = 0.12392   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_D + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##        df     F p-value
## SEX     1 0.044  0.8334
## GRP     2 3.767  0.0255
## aSUP_D  1 1.352  0.2469
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 0.837 0.361721
## s(FAM)  42.98  92.00 0.888 0.000325

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation improved the distribution of residuals. We will continue to work with log-transformed values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_D')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate  Std. Error    t value
## (Intercept)  6.181277836 0.226245837 27.3210677
## GRPVG        0.138166526 0.091275390  1.5137325
## GRPVN        0.242061911 0.079253510  3.0542737
## SEXM        -0.015513468 0.063836408 -0.2430191
## aAGE        -0.005863583 0.006080554 -0.9643173
## aSUP_D       0.081765675 0.068045424  1.2016337


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on log2(vitamin D) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on log2(vitamin D) level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 0.2420619 0.0867279 0.3973959 0.0022561
VG vs OM 0.1381665 -0.0407300 0.3170630 0.1300937
VN vs VG 0.1038954 -0.0485263 0.2563171 0.1815583

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_D'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_D'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_D'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_D'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_D'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.300
##   Unadjusted ICC: 0.274

i = i+1

2.2.41 aFOLAT

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_FOL)) 

column_name
## [1] "aFOLAT"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_FOL + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_FOL + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  11.0890     0.7935  13.975  < 2e-16 ***
## SEXM         -2.2797     0.5395  -4.225 4.47e-05 ***
## GRPVG         3.0293     1.0868   2.787  0.00612 ** 
## GRPVN         3.2882     0.9421   3.490  0.00066 ***
## aSUP_FOL      3.7571     1.7147   2.191  0.03024 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 0.949    0.332    
## s(FAM)  51.65     92 1.293 7.37e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.495   Deviance explained = 64.9%
## GCV = 17.315  Scale est. = 11.977    n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_FOL + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df      F  p-value
## SEX       1 17.853 4.47e-05
## GRP       2  6.643  0.00179
## aSUP_FOL  1  4.801  0.03024
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 0.949    0.332
## s(FAM)  51.65  92.00 1.293 7.37e-06

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_FOL + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_FOL + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.31856    0.09575  34.658  < 2e-16 ***
## SEXM        -0.25051    0.06466  -3.875 0.000169 ***
## GRPVG        0.42023    0.13126   3.202 0.001722 ** 
## GRPVN        0.43708    0.11377   3.842 0.000191 ***
## aSUP_FOL     0.38200    0.20619   1.853 0.066224 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 1.034    0.311    
## s(FAM)  52.31     92 1.328 5.45e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.503   Deviance explained = 65.6%
## GCV = 0.24962  Scale est. = 0.17179   n = 187
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_FOL + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##          df      F  p-value
## SEX       1 15.012 0.000169
## GRP       2  8.246 0.000427
## aSUP_FOL  1  3.432 0.066224
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 1.034    0.311
## s(FAM)  52.31  92.00 1.328 5.45e-06

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation did not improve the fit substantially. We will continue to work with original values.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_FOL')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  8.74539715 2.32388737  3.7632620
## GRPVG        3.26952370 1.00759759  3.2448705
## GRPVN        3.26659330 0.87406001  3.7372644
## SEXM        -2.12938464 0.53158390 -4.0057358
## aAGE         0.05516375 0.06247702  0.8829446
## aSUP_FOL     3.86765482 1.64352693  2.3532653


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM 3.2665933 1.553467 4.979719 0.0001860
VG vs OM 3.2695237 1.294669 5.244379 0.0011750
VN vs VG -0.0029304 -1.776008 1.770147 0.9974154

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_FOL'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_FOL'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_FOL'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_FOL'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_FOL'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.389
##   Unadjusted ICC: 0.323

i = i+1

2.2.42 aUr_Ca

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_FOL)) 

column_name
## [1] "aUr_Ca"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.14629    0.22705   5.049 1.29e-06 ***
## SEXM         0.56361    0.18230   3.092  0.00238 ** 
## GRPVG       -0.02652    0.30562  -0.087  0.93096    
## GRPVN       -0.37643    0.26858  -1.402  0.16314    
## aSUP_Ca     -0.34816    0.39514  -0.881  0.37970    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE)  1.00      1 0.133 0.71536   
## s(FAM)  32.56     92 0.549 0.00899 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.251   Deviance explained = 40.3%
## GCV = 1.7508  Scale est. = 1.3879    n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 9.559 0.00238
## GRP      2 1.335 0.26633
## aSUP_Ca  1 0.776 0.37970
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.133 0.71536
## s(FAM)  32.56  92.00 0.549 0.00899

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.4052     0.2217  -1.828   0.0698 .  
## SEXM          0.6698     0.1598   4.192 4.99e-05 ***
## GRPVG        -0.1145     0.3032  -0.378   0.7064    
## GRPVN        -0.4816     0.2657  -1.813   0.0721 .  
## aSUP_Ca      -0.3184     0.3669  -0.868   0.3871    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value    
## s(aAGE)  1.00      1 0.667    0.415    
## s(FAM)  46.26     92 1.026 8.48e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.39   Deviance explained = 55.9%
## GCV = 1.4529  Scale est. = 1.0446    n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df      F  p-value
## SEX      1 17.575 4.99e-05
## GRP      2  1.936    0.148
## aSUP_Ca  1  0.753    0.387
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F  p-value
## s(aAGE)  1.00   1.00 0.667    0.415
## s(FAM)  46.26  92.00 1.026 8.48e-05

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation did not improve the fit substantially. We will continue to work with original values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_Ca')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  0.28683062 0.74548610  0.3847565
## GRPVG       -0.14813426 0.31132407 -0.4758201
## GRPVN       -0.51352770 0.27332435 -1.8788216
## SEXM         0.67900088 0.17823988  3.8094780
## aAGE        -0.02024741 0.02006671 -1.0090049
## aSUP_Ca     -0.27146859 0.39417225 -0.6887055


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.5135277 -1.0492336 0.0221782 0.0602689
VG vs OM -0.1481343 -0.7583182 0.4620497 0.6342025
VN vs VG -0.3653934 -0.9076132 0.1768263 0.1865717

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Ca'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Ca'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Ca'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Ca'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Ca'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.337
##   Unadjusted ICC: 0.305

i = i+1

2.2.43 aCa_per_Krea

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_FOL)) 

column_name
## [1] "aCa_per_Krea"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.23131    0.02478   9.335   <2e-16 ***
## SEXM        -0.02651    0.02192  -1.210    0.228    
## GRPVG       -0.03479    0.03285  -1.059    0.291    
## GRPVN       -0.04470    0.02885  -1.549    0.123    
## aSUP_Ca      0.01612    0.04490   0.359    0.720    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  2.25  2.818 1.792   0.118
## s(FAM)  16.18 92.000 0.214   0.132
## 
## R-sq.(adj) =  0.126   Deviance explained = 23.2%
## GCV = 0.023284  Scale est. = 0.020352  n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 1.463   0.228
## GRP      2 1.228   0.296
## aSUP_Ca  1 0.129   0.720
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  2.250  2.818 1.792   0.118
## s(FAM)  16.177 92.000 0.214   0.132

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    aSUP_Ca + 
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.60346    0.16636 -15.650   <2e-16 ***
## SEXM        -0.08327    0.13920  -0.598    0.551    
## GRPVG       -0.11334    0.22359  -0.507    0.613    
## GRPVN       -0.20240    0.19565  -1.035    0.303    
## aSUP_Ca      0.28480    0.29655   0.960    0.338    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value  
## s(aAGE)  2.936  3.626 3.263  0.0207 *
## s(FAM)  26.093 92.000 0.401  0.0286 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.211   Deviance explained = 35.2%
## GCV = 0.99101  Scale est. = 0.8097    n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + aSUP_Ca + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##         df     F p-value
## SEX      1 0.358   0.551
## GRP      2 0.539   0.585
## aSUP_Ca  1 0.922   0.338
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  2.936  3.626 3.263  0.0207
## s(FAM)  26.093 92.000 0.401  0.0286

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation did not improve the fit substantially. We will continue to work with original values.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)
## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult',
       include = c('aSUP_FOL')),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate Std. Error     t value
## (Intercept) -3.374568041 0.53164345 -6.34742708
## GRPVG       -0.007476637 0.20401757 -0.03664703
## GRPVN       -0.162625429 0.17832141 -0.91197925
## SEXM        -0.102905332 0.15036190 -0.68438434
## aAGE         0.021788649 0.01432958  1.52053596
## aSUP_FOL    -0.008522708 0.38588646 -0.02208605


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.1626254 -0.5121290 0.1868781 0.3617796
VG vs OM -0.0074766 -0.4073437 0.3923905 0.9707664
VN vs VG -0.1551488 -0.5145968 0.2042993 0.3975636

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult',
  include = c('aSUP_Ca'))

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult',
  include = c('aSUP_Ca'))

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 include = c('aSUP_Ca'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  include = c('aSUP_Ca'),
                  type = 'adult')

### model without other
mod_other_cov <- rlme(type = 'adult')

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                include = c('aSUP_Ca'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.137
##   Unadjusted ICC: 0.134

i = i+1

2.2.44 aI_per_Krea

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_FOL)) 

column_name
## [1] "aI_per_Krea"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   376.40      83.02   4.534 1.21e-05 ***
## SEXM         -219.08      69.90  -3.134  0.00209 ** 
## GRPVG         -89.27     109.14  -0.818  0.41476    
## GRPVN          64.66      94.66   0.683  0.49562    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.00      1 1.012  0.3161  
## s(FAM)  18.66     84 0.289  0.0852 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.165   Deviance explained = 27.8%
## GCV = 2.1634e+05  Scale est. = 1.8587e+05  n = 168
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df     F p-value
## SEX  1 9.824 0.00209
## GRP  2 1.328 0.26828
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 1.012  0.3161
## s(FAM)  18.66  84.00 0.289  0.0852

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   7.8474     0.3092  25.381  < 2e-16 ***
## SEXM         -0.7862     0.1965  -4.000 0.000115 ***
## GRPVG        -0.6744     0.4256  -1.585 0.115874    
## GRPVN        -0.2142     0.3657  -0.586 0.559323    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F  p-value    
## s(aAGE)  1.813  2.195 3.035   0.0484 *  
## s(FAM)  51.232 84.000 1.604 1.64e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.485   Deviance explained = 65.8%
## GCV = 2.0915  Scale est. = 1.3813    n = 168
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 16.001 0.000115
## GRP  2  1.329 0.268818
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F  p-value
## s(aAGE)  1.813  2.195 3.035   0.0484
## s(FAM)  51.232 84.000 1.604 1.64e-06

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation improve the fit substantially. Lets continue with log-scale.

Fit main model

Open code

dat_mod$outcome <- log2(dat_mod$outcome)
column_name <- paste0("log2_", column_name)

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                Estimate Std. Error    t value
## (Intercept)  6.00018133 0.89390181  6.7123494
## GRPVG       -0.66504463 0.37191007 -1.7881867
## GRPVN       -0.29407755 0.32107670 -0.9159106
## SEXM        -0.65835244 0.20708806 -3.1790941
## aAGE         0.05122287 0.02386459  2.1463961


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.2940775 -0.9233763 0.3352212 0.3597138
VG vs OM -0.6650446 -1.3939750 0.0638857 0.0737459
VN vs VG 0.3709671 -0.2629125 1.0048466 0.2513671

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE); icc(mod_main); diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.432
##   Unadjusted ICC: 0.393

i = i+1

2.2.45 aP_per_Krea

Data selection

Open code

column_name <- names(dat_adult)[i+ni]

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome),
         !is.na(aSUP_FOL)) 

column_name
## [1] "aP_per_Krea"

gamm <- gam(
  outcome ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.0693     0.1303  15.882  < 2e-16 ***
## SEXM         -0.4232     0.1009  -4.194 4.77e-05 ***
## GRPVG        -0.3227     0.1757  -1.837   0.0683 .  
## GRPVN        -0.6502     0.1524  -4.266 3.60e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value   
## s(aAGE)  1.00      1 0.094 0.75965   
## s(FAM)  37.29     92 0.686 0.00233 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.376   Deviance explained = 51.5%
## GCV = 0.55163  Scale est. = 0.42622   n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## outcome ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 17.591 4.77e-05
## GRP  2  9.299 0.000159
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value
## s(aAGE)  1.00   1.00 0.094 0.75965
## s(FAM)  37.29  92.00 0.686 0.00233

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Again but with log2-transformed outcome

Open code

gamm <- gam(
  log2(outcome) ~ 
    SEX + 
    GRP +
    s(aAGE) +
    s(FAM, bs="re"), 
  data = dat_mod)

summary(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.0055     0.1391   7.227 1.91e-11 ***
## SEXM         -0.5439     0.1196  -4.547 1.07e-05 ***
## GRPVG        -0.3867     0.1841  -2.101   0.0372 *  
## GRPVN        -0.7098     0.1599  -4.438 1.68e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##           edf Ref.df     F p-value  
## s(aAGE)  1.19  1.337 0.736  0.5249  
## s(FAM)  20.94 92.000 0.296  0.0735 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.283   Deviance explained =   38%
## GCV = 0.70981  Scale est. = 0.61009   n = 186
anova(gamm)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## log2(outcome) ~ SEX + GRP + s(aAGE) + s(FAM, bs = "re")
## 
## Parametric Terms:
##     df      F  p-value
## SEX  1 20.675 1.07e-05
## GRP  2  9.941 8.52e-05
## 
## Approximate significance of smooth terms:
##            edf Ref.df     F p-value
## s(aAGE)  1.190  1.337 0.736  0.5249
## s(FAM)  20.939 92.000 0.296  0.0735

plot(gamm, select = 1)

Open code

### Model check
pltmd(gamm)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Log-transformation did not improve the fit substantially. We will continue to work with original values.

Fit main model

Open code

## main model 
mod_main <- run(
  
  rlme(main = TRUE, 
       remove_random = FALSE,
       type = 'adult'),
  
  path = paste0('gitignore/run/mod_adult_', column_name, '_main_mixef'),
  reuse = TRUE)

summary(mod_main)[['coefficients']]
##                 Estimate Std. Error    t value
## (Intercept)  1.906848881 0.39557989  4.8203888
## GRPVG       -0.349824498 0.15170977 -2.3058798
## GRPVN       -0.624859463 0.13205042 -4.7319763
## SEXM        -0.447671905 0.11152229 -4.0141922
## aAGE         0.003239738 0.01066292  0.3038322


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped',full_width = T) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on folat level, estimated with a robust linear mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.6248595 -0.8836735 -0.3660454 0.0000022
VG vs OM -0.3498245 -0.6471702 -0.0524788 0.0211173
VN vs VG -0.2750350 -0.5399325 -0.0101374 0.0418539

Leave-one-factor mixed models

Open code
### main model but non-robust
mod_main <- rlme( 
  remove_random = FALSE,
  type = 'adult')

res2 <- emm(mod_main)

### model  without random effect
mod_nonran <- rlme(
  remove_random = TRUE,
  type = 'adult')

### model without sex
mod_nsex <- rlme(exclude = c('SEX'),
                 type = 'adult')

### model without diet groups
mod_ndiet <- rlme(exclude = c('GRP'),
                  type = 'adult')

### model without other
mod_other_cov <- NA

### model without age
mod_age <- rlme(exclude = c('aAGE'),
                type = 'adult')

Putting key results together

Open code
AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE)

icc(mod_main) 
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.249
##   Unadjusted ICC: 0.205

diet_adult_non_robust <- add_eff(diet_adult_non_robust, res2, mixef = TRUE)

i = i+1

2.2.46 aAL_adult

Data selection

Open code

column_name <- names(dat_adult)[i+ni]
column_name
## [1] "aAL_adult"

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

Main model

Open code

mod_main <- glmer(
  outcome ~ 
    SEX + 
    GRP +
    aAGE +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)


summary(mod_main)[['coefficients']]
##                Estimate Std. Error    z value   Pr(>|z|)
## (Intercept)  0.59639357 2.01758195  0.2955982 0.76753696
## SEXM        -0.89810720 0.49317267 -1.8210806 0.06859460
## GRPVG       -0.60620973 0.79589327 -0.7616721 0.44625570
## GRPVN       -1.94514535 0.81526576 -2.3859034 0.01703723
## aAGE        -0.03281529 0.05567048 -0.5894559 0.55555549


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on the likelihood of food allergy, estimated with a logistic mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped', full_width = TRUE) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on the likelihood of food allergy, estimated with a logistic mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -1.9451453 -3.543037 -0.3472538 0.0170372
VG vs OM -0.6062097 -2.166132 0.9537124 0.4462557
VN vs VG -1.3389356 -2.872539 0.1946679 0.0870486

Leave-one-factor mixed models

Open code

### model  without random effect
mod_nonran <- glm(
  outcome ~ 
    SEX + 
    GRP +
    aAGE,
  family = binomial(link = 'logit'),
  data = dat_mod)

### model without sex
mod_nsex <- glmer(
  outcome ~ 
    GRP +
    aAGE +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)

### model without diet groups
mod_ndiet <- glmer(
  outcome ~ 
    SEX + 
    aAGE +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)

### model without other covariates
mod_other_cov <- NA

### model without log2_age
mod_age <- glmer(
  outcome ~ 
    SEX + 
    GRP +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)

Putting key results together

Open code

## AIC

AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE)
diet_adult_non_robust <- add_eff(diet_adult_non_robust, res, mixef = TRUE)

diet_adult$estimand[i+1] <- 'log(OR)'
diet_adult_non_robust$estimand[i+1] <- 'log(OR)'

icc(mod_main)
## # Intraclass Correlation Coefficient
## 
##     Adjusted ICC: 0.479
##   Unadjusted ICC: 0.417

i = i+1

2.2.47 aBREAKS

Data selection

Open code

column_name <- 'aBREAKS'
column_name
## [1] "aBREAKS"

dat_mod <- dat_adult %>%
  mutate(outcome = !!sym(column_name)) %>% 
  filter(!is.na(outcome))

Main model

Open code

mod_main <- glmer(
  outcome ~ 
    SEX + 
    GRP +
    aAGE +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)
## boundary (singular) fit: see help('isSingular')


summary(mod_main)[['coefficients']]
##                Estimate Std. Error    z value     Pr(>|z|)
## (Intercept)  0.58183854 1.14349267  0.5088258 6.108744e-01
## SEXM         1.57121600 0.33270878  4.7224964 2.329673e-06
## GRPVG       -0.11966042 0.44060054 -0.2715848 7.859413e-01
## GRPVN       -0.68932448 0.38775435 -1.7777350 7.544739e-02
## aAGE        -0.03230162 0.03105942 -1.0399942 2.983426e-01


res <- emm(mod_main)

suppl_table <- kbl(res, caption = 
      'The effect of diet on the likelihood of having experience of bone break, estimated with a logistic mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval') %>% 
  kable_styling('striped', full_width = TRUE) %>% 
  column_spec(1, width_min = '1in')

suppl_table
The effect of diet on the likelihood of having experience of bone break, estimated with a logistic mixed-effects model in adults. CI_L and CI_U are bounds of 95% confidence interval
Estimate CI-L CI-U P
VN vs OM -0.6893245 -1.4493090 0.0706601 0.0754474
VG vs OM -0.1196604 -0.9832216 0.7439008 0.7859413
VN vs VG -0.5696641 -1.3513739 0.2120458 0.1532037

Leave-one-factor mixed models

Open code

### model  without random effect
mod_nonran <- glm(
  outcome ~ 
    SEX + 
    GRP +
    aAGE,
  family = binomial(link = 'logit'),
  data = dat_mod)

### model without sex
mod_nsex <- glmer(
  outcome ~ 
    GRP +
    aAGE +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)

### model without diet groups
mod_ndiet <- glmer(
  outcome ~ 
    SEX + 
    aAGE +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)

### model without other covariates
mod_other_cov <- NA

### model without log2_age
mod_age <- glmer(
  outcome ~ 
    SEX + 
    GRP +
    (1|FAM),
  family = binomial(link = 'logit'),
  data = dat_mod)

Putting key results together

Open code

## AIC

AIC_adult <- add_AIC_adult(AIC_adult, mixef = TRUE)

diet_adult <- add_eff(diet_adult, res, mixef = TRUE)
diet_adult_non_robust <- add_eff(diet_adult_non_robust, res, mixef = TRUE)

diet_adult$estimand[i+1] <- 'log(OR)'
diet_adult_non_robust$estimand[i+1] <- 'log(OR)'

icc(mod_main)
## boundary (singular) fit: see help('isSingular')
## Warning: Can't compute random effect variances. Some variance components equal
##   zero. Your model may suffer from singularity (see `?lme4::isSingular`
##   and `?performance::check_singularity`).
##   Solution: Respecify random structure! You may also decrease the
##   `tolerance` level to enforce the calculation of random effect variances.
## [1] NA

2.2.48 Saving tables

Open code

## Between-diets differences

if(file.exists('gitignore/data/diet_adult_mixeff.xlsx') == FALSE){
  diet_adult <- diet_adult[-1,]
  
  diet_adult$VN_OM_P_adj <- p.adjust(diet_adult$VN_OM_P, method = 'fdr')
  diet_adult$VG_OM_P_adj <- p.adjust(diet_adult$VG_OM_P, method = 'fdr')
  diet_adult$VN_VG_P_adj <- p.adjust(diet_adult$VN_VG_P, method = 'fdr')
  
# for (i in seq(1, nrow(diet_adult))) {
#   padj <- p.adjust(c(
#     diet_adult$VN_OM_P[i], 
#     diet_adult$VG_OM_P[i],
#     diet_adult$VN_VG_P[i]), 
#     method = 'hochberg')
#   
#   diet_adult$VN_OM_P_adj[i] <- padj[1]
#   diet_adult$VG_OM_P_adj[i] <- padj[2]
#   diet_adult$VN_VG_P_adj[i] <- padj[3]
# }
  
  diet_adult <- diet_adult %>%
    
    select(outcome, estimand, 
         VN_OM_diff, VN_OM_P, VN_OM_P_adj,
         VG_OM_diff, VG_OM_P, VG_OM_P_adj,
         VN_VG_diff, VN_VG_P, VN_VG_P_adj) %>%
    
    mutate(across(.cols = 3:11, .fns = ~as.numeric(as.character(.)))) %>% 
    mutate(across(.cols = c(VN_OM_P, VG_OM_P, VN_VG_P,
                            VN_OM_P_adj, VG_OM_P_adj, VN_VG_P_adj), ~ round(.x, 5)))

  write.xlsx(diet_adult, 'gitignore/data/diet_adult_mixeff.xlsx')
}


if(file.exists('gitignore/data/diet_adult_non_robust_mixeff_non_robust.xlsx') == FALSE){
  diet_adult_non_robust <- diet_adult_non_robust[-1,]
  
  diet_adult_non_robust$VN_OM_P_adj <- p.adjust(
    diet_adult_non_robust$VN_OM_P, method = 'fdr')
  
  diet_adult_non_robust$VG_OM_P_adj <- p.adjust(
    diet_adult_non_robust$VG_OM_P, method = 'fdr')
  
  diet_adult_non_robust$VN_VG_P_adj <- p.adjust(
    diet_adult_non_robust$VN_VG_P, method = 'fdr')
  
# for (i in seq(1, nrow(diet_adult_non_robust))) {
#   padj <- p.adjust(c(
#     diet_adult_non_robust$VN_OM_P[i], 
#     diet_adult_non_robust$VG_OM_P[i],
#     diet_adult_non_robust$VN_VG_P[i]), 
#     method = 'hochberg')
#   
#   diet_adult_non_robust$VN_OM_P_adj[i] <- padj[1]
#   diet_adult_non_robust$VG_OM_P_adj[i] <- padj[2]
#   diet_adult_non_robust$VN_VG_P_adj[i] <- padj[3]
# }
  
  diet_adult_non_robust <- diet_adult_non_robust %>%
    
    select(outcome, estimand, 
         VN_OM_diff, VN_OM_P, VN_OM_P_adj,
         VG_OM_diff, VG_OM_P, VG_OM_P_adj,
         VN_VG_diff, VN_VG_P, VN_VG_P_adj) %>%
    
    mutate(across(.cols = 3:11, .fns = ~as.numeric(as.character(.)))) %>% 
    mutate(across(.cols = c(VN_OM_P, VG_OM_P, VN_VG_P,
                            VN_OM_P_adj, VG_OM_P_adj, VN_VG_P_adj), ~ round(.x, 5)))

  write.xlsx(diet_adult_non_robust, 'gitignore/data/diet_adult_non_robust_mixeff_non_robust.xlsx')
}
## Importance of predictors

if(file.exists('gitignore/data/AIC_adult_mixeff.xlsx') == FALSE){
  AIC_adult <- AIC_adult[-1,]
  write.xlsx(AIC_adult, 'gitignore/data/AIC_adult_mixeff.xlsx')
  }

3 Reproducibility

Open code
sessionInfo()
## R version 4.4.3 (2025-02-28)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=cs_CZ.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=cs_CZ.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=cs_CZ.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=cs_CZ.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Europe/Prague
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] grid      stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] mice_3.17.0        patchwork_1.2.0    ggrepel_0.9.5      robustlmm_3.3-1   
##  [5] gridExtra_2.3      pheatmap_1.0.12    performance_0.12.2 quantreg_5.98     
##  [9] SparseM_1.81       bayesplot_1.8.1    ggdist_3.3.2       kableExtra_1.4.0  
## [13] lubridate_1.8.0    corrplot_0.92      arm_1.12-2         MASS_7.3-64       
## [17] projpred_2.0.2     glmnet_4.1-8       boot_1.3-31        cowplot_1.1.1     
## [21] pROC_1.18.0        mgcv_1.9-1         nlme_3.1-167       openxlsx_4.2.5    
## [25] flextable_0.9.6    sjPlot_2.8.16      car_3.1-2          carData_3.0-5     
## [29] gtsummary_2.0.2    emmeans_1.10.4     ggpubr_0.4.0       lme4_1.1-35.5     
## [33] Matrix_1.7-0       forcats_1.0.0      stringr_1.5.1      dplyr_1.1.4       
## [37] purrr_1.0.2        readr_2.1.2        tidyr_1.3.1        tibble_3.2.1      
## [41] ggplot2_3.5.1      tidyverse_1.3.1   
## 
## loaded via a namespace (and not attached):
##   [1] splines_4.4.3           later_1.3.0             gamm4_0.2-6            
##   [4] cellranger_1.1.0        datawizard_0.12.2       rpart_4.1.24           
##   [7] reprex_2.0.1            lifecycle_1.0.4         rstatix_0.7.0          
##  [10] lattice_0.22-5          insight_0.20.2          backports_1.5.0        
##  [13] magrittr_2.0.3          rmarkdown_2.27          yaml_2.3.5             
##  [16] httpuv_1.6.5            zip_2.2.0               askpass_1.1            
##  [19] DBI_1.1.2               minqa_1.2.4             RColorBrewer_1.1-2     
##  [22] multcomp_1.4-18         abind_1.4-5             rvest_1.0.2            
##  [25] nnet_7.3-20             TH.data_1.1-0           sandwich_3.0-1         
##  [28] gdtools_0.3.7           pbkrtest_0.5.1          crul_1.5.0             
##  [31] MatrixModels_0.5-3      svglite_2.1.3           codetools_0.2-19       
##  [34] xml2_1.3.3              tidyselect_1.2.1        shape_1.4.6            
##  [37] farver_2.1.0            ggeffects_1.7.0         httpcode_0.3.0         
##  [40] matrixStats_1.3.0       jsonlite_1.8.8          mitml_0.4-3            
##  [43] ellipsis_0.3.2          ggridges_0.5.3          survival_3.7-0         
##  [46] iterators_1.0.14        systemfonts_1.0.4       foreach_1.5.2          
##  [49] tools_4.4.3             ragg_1.2.1              Rcpp_1.0.13            
##  [52] glue_1.7.0              pan_1.6                 xfun_0.46              
##  [55] distributional_0.4.0    loo_2.4.1               withr_3.0.1            
##  [58] fastmap_1.2.0           fansi_1.0.6             openssl_1.4.6          
##  [61] digest_0.6.37           R6_2.5.1                mime_0.12              
##  [64] estimability_1.5.1      textshaping_0.3.6       colorspace_2.0-2       
##  [67] utf8_1.2.4              generics_0.1.3          fontLiberation_0.1.0   
##  [70] data.table_1.15.4       robustbase_0.93-9       httr_1.4.2             
##  [73] htmlwidgets_1.6.4       pkgconfig_2.0.3         gtable_0.3.0           
##  [76] htmltools_0.5.8.1       fontBitstreamVera_0.1.1 scales_1.3.0           
##  [79] knitr_1.48              rstudioapi_0.16.0       tzdb_0.2.0             
##  [82] uuid_1.0-3              coda_0.19-4             curl_4.3.2             
##  [85] nloptr_2.0.0            zoo_1.8-9               sjlabelled_1.2.0       
##  [88] parallel_4.4.3          pillar_1.9.0            vctrs_0.6.5            
##  [91] promises_1.2.0.1        jomo_2.7-3              dbplyr_2.1.1           
##  [94] xtable_1.8-4            evaluate_1.0.0          fastGHQuad_1.0.1       
##  [97] mvtnorm_1.1-3           cli_3.6.3               compiler_4.4.3         
## [100] rlang_1.1.4             crayon_1.5.0            rstantools_2.1.1       
## [103] ggsignif_0.6.3          labeling_0.4.2          modelr_0.1.8           
## [106] plyr_1.8.6              sjmisc_2.8.10           fs_1.6.4               
## [109] stringi_1.7.6           viridisLite_0.4.0       assertthat_0.2.1       
## [112] munsell_0.5.0           fontquiver_0.2.1        sjstats_0.19.0         
## [115] hms_1.1.1               gfonts_0.2.0            shiny_1.9.1            
## [118] highr_0.11              haven_2.4.3             broom_1.0.6            
## [121] DEoptimR_1.0-10         readxl_1.3.1            officer_0.6.6